GeoSpatial Search

Jun 25 · 2 min read

GeoSpatial search is about searching/querying for a point, line or polygon in space. There are spatial databases which are solely for those, but many other databases provide libraries that aid in doing spatial searches.

DataStax Enterprise (DSE) uses Cassandra as the underlying database but provides the spatial search functionality via Apache SOLR integration.

Elasticsearch is another key technology that provides spatial search capability.

Apache Lucene is the underlying technology for both of the above: SOLR and Elasticsearch. To know more about Solr and Elasticsearch, head over to my other article:

Apart from Lucene, there are also ways to directly do spatial searches using a concept called GeoHash.

What’s Geohash?

To play around with it, you can use:

Good Article for how to use geohash:

Nearby locations generally have similar prefixes, though not always: there are edge-cases straddling large-cell boundaries; in France, La Roche-Chalais (u000) is just 30km from Pomerol (ezzz). A reliable prefix search for proximate locations will also search prefixes of a cell’s 8 neighbours. (e.g. a database query for results within 30-odd kilometres of Pomerol would be SELECT * FROM MyTable WHERE LEFT(Geohash, 4) IN ('ezzz', 'gbpb, 'u000', 'spbp', 'spbn', 'ezzy', 'ezzw', 'ezzx', 'gbp8'). shows the precision for each character in the geohash.


My technical posts mostly on Java backend services


Written by

Software Engineer working on Java based Micro-services deployed on AWS cloud. California, US resident currently — born and brought up in Bangalore, India.


My technical posts mostly on Java backend services

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade