Forgive me because I don't understand anything about the internals of
web2py but doesn't REPLACE take three parameters:
def REPLACE(self, first, (second, third)):
return 'REPLACE(%s,%s,%s)' % (self.expand(first,'string'),
self.expand(second,'string'),
self.expand(third,'string'))
Also:
def ST_ASGEOJSON(self, first, second):
"""
http://postgis.org/docs/ST_AsGeoJSON.html
"""
return 'ST_AsGeoJSON(%s,%s,%s,%s)' %(second['version'],
self.expand(first), second['precision'], second['options'])
Or do you mean something different?
On Monday, December 9, 2013 4:45:27 PM UTC-5, Massimo Di Pierro wrote:
> OK. This needs more work than anticipated. Looks like the Query object
> only supports unary and binary operators. Give me a little more time. ;-)
>
> On Monday, 9 December 2013 12:21:37 UTC-6, User wrote:
>>
>> Thanks. This is what I see at line 2983 in dal.py:
>>
>> def ST_DWITHIN(self, first, second):
>> """
>> http://postgis.org/docs/ST_Within.html
>> """
>> return 'ST_DWithin(%s,%s)' %(self.expand(first),
>> self.expand(second, first.type))
>>
>>
>> The proper documentation is at http://postgis.org/docs/ST_DWithin.html (note
>> the 'D'). Also looks like this is missing the 3rd argument to ST_DWithin:
>>
>> boolean *ST_DWithin*(geometry g1, geometry g2, double precision
>> distance_of_srid);
>>
>>
>> On Sunday, December 8, 2013 9:25:35 AM UTC-5, Massimo Di Pierro wrote:
>>
>>> Added ST_Dwithin support in trunk. Please check it.
>>>
>>> On Sunday, 8 December 2013 07:02:06 UTC-6, User wrote:
>>>>
>>>> I'm storing latitude/longitude coordinates in a geometry field (using
>>>> PostgreSQL
>>>> 9.1.10):
>>>>
>>>> Field('point', 'geometry()')
>>>>
>>>> I understand there is also the geography type but from my reading
>>>> geometry is faster and is suitable for small distances (
>>>> http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography
>>>> )
>>>>
>>>> I want users to be able to specify a reference point and search for all
>>>> records within X distance from the reference point. Using raw SQL I would
>>>> use ST_DWithin <http://postgis.refractions.net/docs/ST_DWithin.html>
>>>> doing
>>>> something like
>>>>
>>>> SELECT name, ST_AsText(point)
>>>> FROM mytable
>>>> WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326),
>>>> 0.1)
>>>>
>>>> But web2py does not seem to support ST_DWithin only st_within. So how
>>>> can I achieve a similar result in web2py?
>>>>
>>>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.