possible implementation of st_dwithin, thanks User

This commit is contained in:
mdipierro
2013-12-09 17:06:25 -06:00
parent 85058bd847
commit 53122bfa9f
2 changed files with 8 additions and 3 deletions

View File

@@ -1 +1 @@
Version 2.8.2-stable+timestamp.2013.12.08.09.32.29
Version 2.8.2-stable+timestamp.2013.12.09.17.05.33

View File

@@ -2980,11 +2980,12 @@ class PostgreSQLAdapter(BaseAdapter):
"""
return 'ST_Within(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_DWITHIN(self, first, second):
def ST_DWITHIN(self, first, (second, third)):
"""
http://postgis.org/docs/ST_Within.html
"""
return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type))
return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type),
self.expand(third, 'double'))
def represent(self, obj, fieldtype):
field_is_type = fieldtype.startswith
@@ -9674,6 +9675,10 @@ class Expression(object):
db = self.db
return Query(db, db._adapter.ST_WITHIN, self, value)
def st_dwithin(self, value, distance):
db = self.db
return Query(db, db._adapter.ST_DWITHIN, self, (value, distance))
# for use in both Query and sortby