I think it is Field('loc','geometry') and Field('loc','geography') without the ().
On Wednesday, 11 November 2015 08:51:48 UTC-6, Boa wrote: > > I'd like to find all table entries within x meters of a certain location. > The DAL object in question uses the spatialite adapter (my system's > spatialite library is the most recent version), and the field of interest > is of type 'geometry': > > db = DAL('spatialite://...') > db.define_table('point', Field('name'), Field('loc','geometry()')) > > Massimo suggested the following > <https://groups.google.com/d/msg/web2py/ahO2ydF7yK0/yPH1QC-h3IYJ> as a > method of finding rows within distance: > > query = db.point.loc.st_distance(geoPoint(37.7833, 122.4167)) < 10 > rows = db(query).select(db.point.name) > > However, as I understand, the above query does the following > <http://www.postgis.org/docs/ST_Distance.html>: > > For geometry type Returns the 2-dimensional cartesian minimum distance >> (based on spatial ref) between two geometries in projected units. For >> geography type defaults to return spheroidal minimum distance between two >> geographies in meters. >> > > If I change the 'loc' field's type to 'geography()', I get the following > exception: > > 3. Exception in 'point definition': Field: unknown field type: geography() > for loc > > I've also tried tinkering with the st_within() method > <https://groups.google.com/forum/#!searchin/web2py/st_within/web2py/mHHeVNfYV6g/rev9zRKBdXcJ>, > > but doing so generates this error message: > > <type 'exceptions.AttributeError'> 'SpatiaLiteAdapter' object has no > attribute 'ST_DWITHIN' > > When using the spatialite adapter, what is the recommended way to find > records within some distance, measured in meters? > > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.