4

Amazon's AWS DynamoDB features Geospatial Indexing, which facilitates geo queries:

Query Support: Box queries return items that fall within a pair of geo points that define a rectangle as projected on a sphere. Radius queries return items that fall within a given distance from a geo point.

The problem is that the boto, the Python library for accessing AWS Service, lacks any reference to geo object. The Java equivalent, on the other hand, has such support.

Is there a way to use the geo features of DynamoDB on AWS using Python?

Gonçalo Peres
1451 gold badge1 silver badge8 bronze badges
asked Jun 8, 2014 at 7:40

2 Answers 2

6

The "geospatial feature" of dynamodb isn't really anything else then calculating a geohash from the coordinates, storing the hash in the same row, create an index on the hash, and when querying based on a location, calculate the hash of that location and compare to the indexed hashes in the table. The algorithm of geohash is really simple and with a reasonable knowledge it could be coded in a couple of hours in any language. You could even create a lambda function (since October 2015 even in Python!) that is attached to a dynamodb stream and stores the geohash automagically.

But probably it is a much better idea to check out dynamodb streams + lambda + cloudsearch integration that has native support for geospatial queries and boto also has a cloudsearch interface.

answered Oct 20, 2015 at 21:40
3
  • 1
    there's this implementation in python here following @MrTJ comment but it's bit more complicated then he explained it. Commented Apr 16, 2020 at 8:01
  • Please don't post links only. They become obsolete when the site goes down. Please include a short explanation or excerpt from the referenced site. Commented Apr 16, 2020 at 8:23
  • 1
    You're totally right but this was a github project link to install the module dynamodb geo for python. The explaination of how it works is same as @MrTJ comment but with complication on how to get the closest points, it will require going deeply into the implementation details. Commented Apr 16, 2020 at 10:05
1

Well, this is about a year late and I doubt you still need this solution, but the only way you can really do that is use Jython, or you'd have to set up some Java "server" locally and communicate with that from your python server (probably, the greater of the two evils, but I guess it depends where you're standing!).

(Neither solution is probably very practical for you..)

answered May 23, 2015 at 0:56
1
  • au contraire, The question is very much valid, and your solutions are very nice workarounds. The only reason I don't accept the answer is that I'm looking for a full Pythonic access to Dynamo. Commented May 23, 2015 at 20:24

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.