3

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?

4

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.

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..)

  • 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. – Adam Matan May 23 '15 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.