possible implementation of st_dwithin, thanks User
This commit is contained in:
@@ -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
|
||||||
|
|||||||
+7
-2
@@ -2980,11 +2980,12 @@ class PostgreSQLAdapter(BaseAdapter):
|
|||||||
"""
|
"""
|
||||||
return 'ST_Within(%s,%s)' %(self.expand(first), self.expand(second, first.type))
|
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
|
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):
|
def represent(self, obj, fieldtype):
|
||||||
field_is_type = fieldtype.startswith
|
field_is_type = fieldtype.startswith
|
||||||
@@ -9674,6 +9675,10 @@ class Expression(object):
|
|||||||
db = self.db
|
db = self.db
|
||||||
return Query(db, db._adapter.ST_WITHIN, self, value)
|
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
|
# for use in both Query and sortby
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user