Spatial Data Overview
Learn how to store and query geographical and geometric data in Cosmos DB.
Introduction
Sometimes, we might need to store shapes, locations, or other spatial data and perform queries on them. Cosmos DB natively supports this kind of data following the GeoJSON specification.
Representations
Spatial types can be indexed in two different ways. It’s a setting on the container level, changing what the data represents and how queries perform calculations on it.
Geometrical: Data belongs to a flat (Euclidean) coordinate system.
Geographical: Data belongs to an earth coordinate system. Since the planet is not regular, data is represented on the WGS-84 coordinate reference systems (CRS). Altitude and other elements are considered during queries but are still approximated.
Longitude: ± 180 degrees from the prime meridian.
Latitude: ± 90 degrees from the equator.
Data types
There are four different types of spatial data we can use: