Thank you for the recommendations Robert. My app now filters according to geopt while also ordering and filtering by datetime. The radius parameter you can increase factor 10 or 100 to fetch everything. And decrease radius and vary lat,lng to pinpoint things. I don't prepopulate a database with all the world's named locations, all geography stored is a geopt per article and the local geography names are fetched via gmaps. //Niklas
China http://classifiedsmarket.appspot.com/market/?radius=1.5&lat=35.5219754&lng=105.7325613 India http://classifiedsmarket.appspot.com/market/?radius=3&lat=12.4036408&lng=77.0823161 North America http://classifiedsmarket.appspot.com/market/?radius=3&lat=38.8284657&lng=-106.5819789 South America http://www2.montao.com.br/market/?radius=5&lat=-23.604049&lng=-46.5816998 (same app) On Dec 3, 10:53 am, Robert <[EMAIL PROTECTED]> wrote: > Agree that it would be very nice to be able to do clever queries on > GeoPt fields. I.e. find records for which some GeoPt field is within > some boundaries. Where "boundaries" could given as a radius around a > point, or perhaps even a polygon. Likewise I can see that some folks > would like queries for "west of" etc. > > On the side: float operations are rather expensive, so I recommend > to: > - scale up to integers whenever that is feasible > - compute a float only once; in your code you should compute the 'lat' > of the request only once and not everyt time the loop is traversed. > > - Robert > > On Dec 3, 5:02 am, niklasr <[EMAIL PROTECTED]> wrote: > > > There's the problem of "show everything close to a geopt". I came > > around it by iterating a 2nd time after the query and saving only > > nearby entities to a new list as at most one property per query can > > have inequality filter and geohash isn't usable. So we can filter and > > find everything in a radius or even exactly within by geopts defined > > city limits. It would however be preferred to do this without the 2nd > > iteration. > > L=[] > > things = Thing.all().filter("modified >", twomonthsback).order("- > > modified) > > if self.request.get('lat'): > > for thing in things: > > if thing.geopt: > > if thing.geopt.lat < float(self.request.get > > ('lat')): > > L.append(thing) > > Despite the extra iteration this way seems better for the user than > > geohash as there are no borders, Now close but different geopt inputs > > will output more similar lists than with the geohash where the geohash > > border could be e.g. in the middle of a locality. Please let me know > > your comments. > > best regards, > > Niklas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
