Geographic Features
Deslize para mostrar o menu
Discover geography data types and functions in BigQuery, with a focus on working with geographic points created from latitude and longitude values. While these features are more specialized, they are extremely useful for location-based analysis such as mapping, transportation, and delivery data.
Geography Points
BigQuery uses the GEOGRAPHY data type to represent locations on the Earth's surface. When a dataset includes latitude and longitude values, they can be combined into a single geographic point that BigQuery can interpret spatially.
Geography points are commonly used in scenarios involving:
- Mapping and visualization;
- Transportation and routing data;
- Delivery zones and service areas;
- Any analysis that depends on physical location.
Creating Geographic Points
Geographic points are created using the ST_GEOGPOINT(longitude, latitude) function. This converts raw coordinate values into a spatial object that can be used in distance calculations and spatial queries.
For example, a city's latitude and longitude columns can be combined to generate a point representing its exact location.
Calculating Distance
The ST_DISTANCE(pointA, pointB) function calculates the distance between two geographic points, typically returning the result in meters.
Common use cases include:
- Measuring the distance between two cities;
- Calculating delivery route lengths;
- Determining service radius around a location.
Filtering and Comparison
Geographic calculations can be combined with standard filters, such as limiting results to specific cities. This makes it possible to compare distances dynamically across selected locations within a dataset.
Although geography functions are not used in every project, they unlock powerful spatial analysis capabilities in BigQuery. When working with location-based data, these tools enable accurate distance calculations and meaningful geographic insights.
Obrigado pelo seu feedback!
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo