views:

730

answers:

3

How should I create a GQL query that returns the nearest entities (from my current location) based on their GeoPt property? Should I just created a 'distance' function that calculates for a set of entities with a reasonably close distance?

Thanks ahead of time!

+1  A: 

You could store the locations in App Engine in a Quadtree structure.

Here's one description of how it would be done: Geographic Queries on Google App Engine

pufferfish
+1  A: 

App Engine doesn't treat GeoPt properties specially - it has no built in spatial indexing. There are a number of third-party libraries that add support for spatial indexing, however. The best one (in my opinion) being geomodel.

Nick Johnson
A: 

geohash set very close points in different hashes so another or next layer should be preferred. you can make a radius, quadratic inside/outside shape test or even any mathematical shape and test whether the point is within our outside the shape.

LarsOn