how to create google maps with mashed with about 10,000 geo codes

3 views
Skip to first unread message

perinouk

unread,
Apr 18, 2009, 5:06:51 PM4/18/09
to Google App Engine
Hi,

I have an urgent need to present about 10,000 locations on a google
map. I have geo codes (latitude and longitude) for the locations but I
need to understand how I can quickly create a map like this and if I
need to host this locally or google allow me to host it on their
servers. Also, I would like access control to the map.

Thnks for all your help!

jguix

unread,
Apr 20, 2009, 6:47:57 PM4/20/09
to Google App Engine
Think on having a dbmodel to store that locations, like the following:

# model definition
class Poi(db.Model):
name = db.StringProperty()
lat = db.FloatProperty()
lon = db.FloatProperty()
geohash = db.StringProperty()

Geohash is a string built from longitude and latitude values that can
be used as a geographical index, and to perform proximity queries, and
sort of bbox queries. The following is a sample bbox query based on
geohash properties:

# query code
southwest = str(Geohash((minlon,minlat)))
northeast = str(Geohash((maxlon,maxlat)))
q = db.GqlQuery("SELECT * FROM Poi " +
"WHERE geohash > :1 AND geohash <= :2 " +
"ORDER BY geohash DESC",
southwest, northeast)

That can get more complicated if your bbox crosses the equator or the
-180º meridian, even in other cases as I heard, and you also might
have to filter false positives -data returned by the query that falls
out the bbox-, but it's a beginning.

I describe my approach here:
http://public.grupoinnovant.com/blog/?p=23

Other interesting references:
http://labs.metacarta.com/blog/27.entry/
http://mappinghacks.com/code/geohash.py.txt
http://en.wikipedia.org/wiki/Geohash
http://catherinedevlin.blogspot.com/2008/09/bigtable-blues.html

Tim Hoffman

unread,
Apr 21, 2009, 6:55:16 AM4/21/09
to Google App Engine
Remember you can only return a max of 1000 items in a query,
so you would need async populate a map via ajax calls for instance
if you wanted all those locations on the map

T
Reply all
Reply to author
Forward
0 new messages