Pierre a écrit :
Here is some code + corresponding output, you will see that it retrieves a point located outside bbox :Yep Adam, you're right. Turning into string seems to turn false to true. Good point but it doesn't solve my troubles completely.I try to copy paste some code and output to show you some weird things. Regards, Pierre On 4 sep, 19:31, Adam <[EMAIL PROTECTED]> wrote:Should you be using: str(hashPoi) > str(hashSW) or Geostring instead? A On Sep 4, 6:59 am, Pierre <[EMAIL PROTECTED]> wrote:Hi,Here's an example : [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.>>> import geohashhashSW = geohash.Geohash((1.5765380859375,42.894076403348976)) hashNE = geohash.Geohash((6.1907958984375,44.3002644115815)) hashPoi = geohash.Geohash((3.867915,43.733638)) hashPoi > hashSWFalsehashPoi < hashNETrueWith geoIndex :>>> hashSW = geohash.Geoindex((1.5765380859375,42.894076403348976))hashNE = geohash.Geoindex((6.1907958984375,44.3002644115815)) hashPoi = geohash.Geoindex((3.867915,43.733638)) hashPoi > hashSWFalsehashPoi < hashNETrueI might be missing something but I thought : hash(SW) < hashPoi < hash(NE)How do you use it and do you find something different ?Regards,PierreOn 4 sep, 12:33, Ubaldo Huerta <[EMAIL PROTECTED]> wrote:Do you have a example of a point whose geohash value isn't greater than SW, NE geohashes?I've tried, in the python interpreter, many examples, and haven't observed what you're describing. It's pretty scary because I'm writing a lot of code for a geo app that's based on that property of geohashes, described athttp://labs.metacarta.com/blog/27.entry/, working. I knew about equator, etc cases needed special handling, but I'm not too concerned.-UOn Sep 3, 10:23 pm, Pierre <[EMAIL PROTECTED]> wrote:Hi,I need to find points (lat/lng) within a certain bounding box. To do so, I tried Geohash python implementation (http://mappinghacks.com/ code/geohash.py.txt).Problem's data is : - I have 2 points (South west SW corner / North east NE corner) describing a geographic Bounding box - I have a model (let's call it 'Poi') having a field "geohash" of type Db.StringProperty + Lat and Lng field (Float)Question is : How on earth (lol :-) ) can I find all Poi within my bounding box ?I've already tried something like :Create Geohash for SW, create Geohash for NE and do something like :"SELECT * FROM Poi WHERE geohash >:1 and geohash <= :2, geohash(SW), geohash(NE)"Also tried with geoindex, at different depth but all this fails and still give points not located within Bounding box. Also tried like describe in "http://labs.metacarta.com/blog/27.entry/ geographic-queries-on-google-app-engine/" to create a small surrounding box for each Poi and then create a geohash for this specific bounding box to be in between my SW->NE bounding box....Nothing is working even with "not worst case" (I mean equatorial problem...) case/Any help will be greatly appreciated.Thanks all,Pierre geoHash1 = geohash.Geohash((float(point[1]), float(point[0]))) geoHash2 = geohash.Geohash((float(point[3]), float(point[2]))) logging.info(" SW : "+str(point[0])+" "+str(point[1])+"\n\t\t"+str(geoHash1)) logging.info(" NE : "+str(point[2])+" "+ str(point[3])+"\n\t\t"+str(geoHash2)) pois = db.GqlQuery("Select * from Poi WHERE geoHash >:1 and geoHash <:2",str(geoHash1),str(geoHash2)) pois1 = Poi.all() logging.info("Points already in the datastore : ") for poi in pois1: logging.info(" Geohash poi "+poi.geoHash+" poiKey : "+str(poi.key())+" lat : "+str(poi.lat)+" Lng : "+str(poi.lng)+" ") logging.info("-------------------------------------------------------") logging.info("Points for the given Bbox : ("+str(point[0])+","+str(point[1])+")->("+str(point[2])+" "+ str(point[3])+")") if pois.count() != 0: for poi in pois: logging.info(poi.geoHash+" poiKey : "+str(poi.key())+" lat : "+str(poi.lat)+" lng : "+str(poi.lng)) ************************************************************************************ And now, let's have a look at some output when draging map around and trying to see if point disapear both from screen and from query result when out of the (SW, NE) bbox : INFO:root: SW : 43.26720631662829 4.61151123046875 speq0uw18pb50 INFO:root: NE : 44.18220395771566 8.12713623046875 spvg2gn5bpb08 INFO:root:Points already in the datastore : INFO:root: Geohash poi spfb018s0yn6w poiKey : ag9hbmFseXRpY3NtYXNodXByCQsSA1BvaRgBDA lat : 43.602709 Lng : 3.867915 INFO:root:------------------------------------------------------- INFO:root:Points for the given Bbox : (43.26720631662829,4.61151123046875)->(44.18220395771566 8.12713623046875) INFO:root:spfb018s0yn6w poiKey : ag9hbmFseXRpY3NtYXNodXByCQsSA1BvaRgBDA lat : 43.602709 lng : 3.867915 ********************* Clearly : the unique point should be OUTSIDE the bbox thus not return in output "Points for the given Bbox". So, Am I doing something wrong either with datastore / GQL or geohash ? Thanks. Pierre --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~--- |
- [google-appengine] Problems with Geohash / Inaccuracy / ... Pierre
- [google-appengine] Re: Problems with Geohash / Inac... Ubaldo Huerta
- [google-appengine] Re: Problems with Geohash / ... Pierre
- [google-appengine] Re: Problems with Geohas... Adam
- [google-appengine] Re: Problems with Ge... Pierre
- [google-appengine] Re: Problems wi... Pierre VANNIER
- [google-appengine] Re: Problem... Adam
- [google-appengine] Re: Pro... Pierre
- [google-appengine] Re: Pro... Mark
- [google-appengine] Re: Pro... Pierre VANNIER
- [google-appengine] Re: Problems with Geohash / Inac... [EMAIL PROTECTED]