Hey all,

I need to do some geospatial queries for my current project.
Unfortunately, GAE doesn't allow multiple numerical comparisons in one
query, so proximity queries based on latitude/longitude columns are
out.

GeoModel to the rescue (http://code.google.com/p/geomodel/).

By extending GeoModel, a GAE entity gains a location property that can
be queried by distance/bounding box, etc. My question is how can I use
this in a web2py model?

Example code from http://code.google.com/p/geomodel/wiki/Usage :

from geo.geomodel import GeoModel

class MyEntity(GeoModel):
  foo = db.StringProperty()
  bar = db.IntegerProperty()


some_entity = MyEntity(location=db.GeoPt(37, -122),
                       foo='Hello',
                       bar=5)
...
some_entity.location = db.GeoPt(38, -122)
some_entity.update_location()
some_entity.put()


resuts = MyEntity.proximity_fetch(
             MyEntity.all().filter('bar <', 10),  # Rich query!
             geotypes.Point(39, -121),  # Or db.GeoPt
             max_results=10,
             max_distance=80467)  # Within 50 miles.


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to