make the bbox param more self-documenting

This commit is contained in:
Schuyler Erle 2011-08-27 18:41:15 -07:00
parent 393d0f0291
commit 3f36a2e2af

View File

@ -16,8 +16,8 @@ class FeatureSearchManager(models.GeoManager):
cursor = connection.cursor
cursor.execute("""SELECT set_limit(%f)""" % threshold)
def overlaps(self, bbox, text=None):
bbox = 'POLYGON(((%f %f, %f %f, %f %f, %f %f, %f %f)))' % (bbox[0], bbox[1], bbox[2], bbox[1], bbox[2], bbox[3], bbox[0], bbox[3], bbox[0], bbox[1])
def overlaps(self, (minlon, minlat, maxlon, maxlat), text=None):
bbox = 'POLYGON(((%f %f, %f %f, %f %f, %f %f, %f %f)))' % (minlon, minlat, minlon, maxlat, maxlon, maxlat, maxlon, minlat, minlon, minlat)
qset = super(FeatureSearchManager, self).get_query_set().filter(geometry_bboverlaps=bbox)
if text:
text = text.replace("'", "''") # escape the '