From 3f36a2e2af175238ea6588ba09acd83169958fe2 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Sat, 27 Aug 2011 18:41:15 -0700 Subject: [PATCH] make the bbox param more self-documenting --- gazetteer/places/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index d68a911..4a6fcf0 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -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 '