3

I'm new to geohashing and am looking to implement it in Google Cloud Datastore.

My goal is to store lat/long data in the form of a geohash and then query for all Entities around 400 meters from a given lat/long.

Has anyone done this successfully and efficiently?

There are some edge-cases with geohashing where you need to check neighboring cells but I want to avoid querying too many data points that I won't be using.

In the end, it sounds like I will need to calculate the distance between the given lat/long and all the entities returned to make sure they are x meters from the given lat/long.

This then poses another problem which is how can I implement a cursor with the result set?

These are some of the problems I have identified. If anyone has advice and tips or some code (in Java) on how to do geohashing with Datastore I would greatly appreciate it! Thank you!

Micro
  • 10,303
  • 14
  • 82
  • 120

1 Answers1

1

Datastore is ill-suited for this.

But according to this answer

https://stackoverflow.com/a/1037891/4458510

it looks like there is a module you can setup that tries provide some level of this functionality within datastore, but it it probably won't be perfect: https://code.google.com/archive/p/geomodel/

So I guess it depends on your needs. If you need this to be done right, you may want to pick a different storage solution that out-right supports geospatial functionality: https://cloud.google.com/storage-options/

I needed to do something similar so this is how I did it in Datastore and it was good enough for my needs https://stackoverflow.com/a/45602189/4458510

Alex
  • 5,141
  • 12
  • 26