On Wed, Aug 28, 2013 at 7:26 AM, Ranjeet sengar <sengar6...@gmail.com>
 wrote:

> Im developing an application where I store location information in the
> datastore.Im trying to fetch all the points (lat,long) within a specified
> radius of a given point.
> Similar to this 
> stackoverflow<http://stackoverflow.com/questions/2411528/query-points-within-a-given-radius-in-mysql>
>  question
> on SQL. I would like to know if the same can be achieved with gql. (similar
> to http://www.movable-type.co.uk/scripts/latlong-db.html)
>
>

You can't do radius-style queries directly in App Engine. The best you can
do is a process called geohashing/bounding. As Jim said, it basically works
by breaking down the world into smaller and smaller boxes. Here's an
introductory article on it written way back in 2009:
https://developers.google.com/appengine/articles/geosearch

A note of warning: using this system can be very expensive (monetarily and
time-wise) if you aren't experienced in it.

On the other hand, there are implementation-specific ways to fix this
problem. For example, if you're trying to create a location list of stores,
points of interest, etc, there are services available such as Factual:
http://factual.com (this is a very popular and widely used service,
companies such as Groupon use it).


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com






On Thu, Aug 29, 2013 at 11:23 AM, Jim <jeb62...@gmail.com> wrote:

> Ranjeet,
>
> I don't think you can do a radius search with GQL, unless they've added
> functionality since I was building code for doing spatial queries a couple
> of years ago. I wound up using the Geo Hash technique which doesn't provide
> a radius search but does let you search in bounding rectangles.  It reduces
> a lat/lon down to a hash value, and you can strip bytes off the right side
> of the hash to search by increasingly larger bounding rectangles.  It was
> the best solution I could find that works with the limitations of the GAE
> database.
>
> Another option that might be available for you to use soon is the new
> Cloud SQL service.  It currently uses MySQL 5.5, but as soon as they
> upgrade to 5.6.x you'll be able to use the ST_CONTAINS functions (and other
> ST_ geo functions) in your queries which will do proper spatial queries.
>  Until then the CONTAINS function just does a bounding box search.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to