What’s Trending with GeoSpatial Indexing?
Do you want to store and retrieve data based on their geographic location? If yes, then you want to create a GeoSpatial Index.
What is a GeoSpatial Index?
The fundamental idea is to geohash the lat-long pairs in a smart way. For example, the geohash for the area around India Gate in New Delhi is ttnfv2u
. The geohash t
covers the entire India. The hashes are hierarchical and designed so that one hash string contains the other string if the corresponding areas are also contained similarly.
If you are not following Jordan has no life yet on youtube, you probably should. I would not be able to better explain it in this post than how it is in this video.
Will Hill shows few examples in his post as well.
Some Examples of Practical Usage
Redis
Redis has nice and easy-to-use support for Geospatial Indexing.
For example, you could do:
GEOADD uber 12.951198, 77.699766 uberInMarathalliBangalore
GEOADD uber 12.922943, 77.673159 uberInBellandurBangalore
You could find the distance between them (in miles):
GEODIST uber uberInMarathalliBangalore uberInBellandurBangalore m
You will find more details about the syntax and other features of Redis here.
MongoDB
MongoDB stores data as GeoJSON. This allows it to query with $near
kind of operators. More on it here.
What is Trending in 2024? 2D to 3D geohashes!
So far, we saw 2D geohashes. How about 3D data? Cesium is an open platform for software applications that creates 3D tiles. NVIDIA Omniverse has a bunch of APIs for building 3D applications. See what this blog at NVIDIA says:
Cesium’s open-source Omniverse extension, Cesium for Omniverse, delivers 3D Tiles and real-world digital twins at global scale with remarkable speed and quality. The extension enables users to create real-world-ready models from any source of 3D geospatial content at rapid speeds and high accuracy using OpenUSD.
They go on to discuss creating a full-scale virtual globe! I would say, it is a must-read for all map-lovers.
Just following the progress in this landscape is so mindblowing!