Our needs involve displaying embedded maps in our app with location markers 
overlayed on the map.  A given app can have 50,000 or more markers (every 
house in a town) so we can't simply display them all at once.  So, we use 
a tile-based approach that renders only (roughly) the tiles that are 
"visible" based on the zoom level of the embedded map.

To accomplish this with Datastore we use the Geohash algorithm: 
 https://en.wikipedia.org/wiki/Geohash

Geohash converts lat/lon coordinates into a hash, and by removing the 
rightmost digits from the hash you can get bounding rectangles of less 
granularity as you remove more characters from the right of the hash.  In 
this way you can zoom in and out with the map and issue simple Datastore 
queries to retrieve all the records with the matching hash portion.  To 
further improve end-user performance we also pre-render the different 
"tiles" and store them as blobs in GCS.

It isn't pretty like the geospatial queries you could do with Cloud SQL, 
but it works just fine and performs really well.



On Monday, January 4, 2016 at 2:50:44 PM UTC-6, Alex Kerr wrote:
>
> Hi all,
> Wondering how best to implement some basic geolocation stuff using Google 
> Cloud products (and open source if appropriate)
>
> I need to search user records I'm storing in Datastore, which include the 
> user's address (in ordinary human readable text format) to see which other 
> users are within a certain distance from them. Seems I can't do a 
> geospatial search directly on Datastore records but found something that 
> suggests a clever little mashup with Google's Search API: 
> http://ralphbarbagallo.com/2013/05/14/app-engine-geospatial-datastore-search-a-new-way/
>
> Questions:
> 1.) Is there any better (/more standard) way than what's suggested at that 
> link? (I know Cloud SQL allows geospatial searches but ideally I want to 
> use Datastore if possible to store my data in)
> 2.) Geospatial matches (at least using above techniques) need latitude and 
> longitude - are there any Google APIs or open source PHP stuff I could use 
> to convert addresses into lat/lon?
>
> I'm running on PHP AppEngine by the way and need a solution I can 
> implement very quickly and easily if at all possible!
>
> Many thanks for any info/suggestions!
>

-- 
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 https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/02c007b0-e559-4f05-83cc-2ee088f9c9e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to