Note that there are some explanatory texts on larger screens.

plurals
  1. POEmpty bounding box result with geomodel in GAE
    text
    copied!<p>I'm attempting to do a bounding box fetch in the GAE using geomodel in python. It is my understanding that you define a box and then the geomodel fetch will return all results with co-ordinates that lie within this box. I am currently inputting a GPS latitude and longitude (55.497527,-3.114624), and then establishing a bounding box with N,S,E,W within a given range of this co-ordinate like so:</p> <pre><code>latRange = 1.0 longRange = 0.10 provlat = float(self.request.get('latitude')) provlon = float(self.request.get('longitude')) logging.info("Doing proximity lookup") theBox = geotypes.Box(provlat+latRange, provlon-longRange, provlat-latRange, provlon+longRange) logging.info("Box created with N:%f E:%f S:%f, W:%f" % (theBox.north, theBox.east, theBox.south, theBox.west)) query = GeoVenue.all().filter('Country =', provcountry) results = GeoVenue.bounding_box_fetch(query, theBox, max_results=10) if (len(results) == 0): jsonencode = json.dumps([{"error":"no results"}]) self.response.out.write(jsonencode) return; ... </code></pre> <p>This always returns an empty result set, even though I know for a fact there are results within the range specified in the box logging output :</p> <blockquote> <p>INFO 2011-07-19 20:45:41,129 main.py:117] Box created with N:56.497527 E:-3.214624 S:54.497527, W:-3.014624</p> </blockquote> <p>The entries in my datastore include: {"venueLat": 55.9570323, "venueCity": "Edinburgh", "venueZip": "EH1 3AA", "venueLong": -3.1850223, "venueName": "Edinburgh Playhouse", "venueState": "", "venueCountry": "UK"} and {"venueLat": 55.9466506, "venueCity": "Edinburgh", "venueZip": "EH8 9FT", "venueLong": -3.1863224, "venueName": "Festival Theatre Edinburgh", "venueState": "", "venueCountry": "UK"}</p> <p>Both of which most definitely have positions that are within the bounding box defined above. I have turned debug on and the bounding box fetch does seem to search geocells since I get output along the lines of :</p> <blockquote> <p>INFO 2011-07-19 20:47:09,487 geomodel.py:114] bbox query looked in 4 geocells</p> </blockquote> <p>However, no results ever seem to get returned. I have ensured I ran update_location() for all models to make sure the underlying geocell data was correct. Does anyone have any ideas?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload