Microsoft has added Geospatial indexing and querying support in Azure DocumentDB. The recently released DocumentDB service update includes support for automatic indexing of geospatial data as well as SQL support for performing proximity queries stored in DocumentDB.
The .NET SDK 1.4 includes new types for representing points and polygons, support for creating and enabling spatial indexing on DocumentDB collections in addition to new LINQ query operators for performing spatial queries.
Microsoft has designed DocumentDB’s database engine to be truly schema agnostic and provide first class support for JSON. The write optimized database engine of DocumentDB now natively understands spatial data represented in the GeoJSON standard.
Microsoft has created a DocumentDB collection in the playground with a scientific dataset containing JSON data about volcanoes. The demo examines the usage of ST_DISTANCE and ST_WITHIN, which examines if a point lies within a polygon.
“Having the backend do the heavy lifting of “location and distance” math married with the power of querying geospatial data via LINQ makes DocumentDB a perfect backend for modern location based applications,” said Ryan Groom, Founder, Trekkit.com.
When location data is indexed, it goes through a process called as tessellation. Here all the cells that intersect a location are identified and stored as keys in the DocumentDB index.