well done! All the former tests worked. I will investigate more the others functions as soon as possible.
Paolo On Sunday, January 6, 2013 4:28:13 PM UTC+1, Massimo Di Pierro wrote: > > One more try please. > > On Sunday, 6 January 2013 02:11:09 UTC-6, Paolo valleri wrote: >> >> Hi Massimo, I've tried the same 3 tests. >> The first one failed, it was working before though, the ticket: >> >> Traceback (most recent call last): >> File "/home/paolo/Dropbox/git/web2py/gluon/restricted.py", line 212, in >> restricted >> exec ccode in environment >> File "/home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py" >> <http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py>, line 586, in >> <module> >> print db(query)._select(db.test_geo.id, db.test_geo.loc_test) >> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 8928, in _select >> return adapter._select(self.query,fields,attributes) >> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1478, in _select >> sql_f = ', '.join(map(geoexpand, fields)) >> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1477, in geoexpand >> return self.expand(field) >> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1312, in expand >> return op(first, second) >> TypeError: ST_ASTEXT() takes exactly 2 arguments (3 given) >> >> >> The other two test worked, but than the application failed raising the >> same ticket as the first test. >> Hope it helps, >> >> Paolo >> >> On Sunday, January 6, 2013 1:46:00 AM UTC+1, Massimo Di Pierro wrote: >>> >>> If something still fails, can you place post the result of print db(...) >>> _select(...) >>> >>> On Saturday, 5 January 2013 18:45:26 UTC-6, Massimo Di Pierro wrote: >>>> >>>> I made some changes in trunk. Can you please try again? >>>> >>>> On Saturday, 5 January 2013 07:05:48 UTC-6, Paolo valleri wrote: >>>>> >>>>> Hi, I made a few more tests: >>>>> from gluon.dal import geoPoint, geoLine, geoPolygon >>>>> db.define_table('test_geo', >>>>> Field('loc_test','geometry()')) >>>>> db.test_geo.insert(loc_test=geoPoint(45.89096,11.0401399)) >>>>> db.test_geo.insert(loc_test=geoPolygon((0,0),(150,0),(150,150),(0,150 >>>>> ),(0,0))) >>>>> >>>>> query = db.test_geo.loc_test.st_contains(geoPoint(1,1)) >>>>> print db(query).select(db.test_geo.id, db.test_geo.loc_test) >>>>> >>>>> dist = db.test_geo.loc_test.st_distance(geoPoint(45.0,11.0)). >>>>> with_alias('dist') >>>>> print db(db.test_geo.id>0).select(db.test_geo.id, dist) >>>>> >>>>> dist = db.test_geo.loc_test.st_distance(geoPoint(45.0,11.0)) >>>>> print db(db.test_geo.id>0).select(db.test_geo.id, dist) >>>>> The results are the following: >>>>> >>>>> The first query worked >>>>> >>>>> The second query failed with the following error: >>>>> Traceback (most recent call last): >>>>> >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/restricted.py", line 212, in >>>>> restricted >>>>> exec ccode in environment >>>>> File "/home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py" >>>>> <http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py>, line 589, >>>>> in <module> >>>>> print db(db.test_geo.id>0).select(db.test_geo.id, dist) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 8975, in select >>>>> return adapter.select(self.query,fields,attributes) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1636, in select >>>>> return self._select_aux(sql,fields,attributes) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1601, in >>>>> _select_aux >>>>> self.execute(sql) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1714, in >>>>> execute >>>>> return self.log_execute(*a, **b) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1708, in >>>>> log_execute >>>>> ret = self.cursor.execute(*a, **b) >>>>> ProgrammingError: syntax error at or near "AS" >>>>> LINE 1: ...GeomFromText('POINT (45.000000 11.000000)',4326)) AS dist) F... >>>>> >>>>> >>>>> The third one failed with the following error: >>>>> >>>>> Traceback (most recent call last): >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/restricted.py", line 212, in >>>>> restricted >>>>> exec ccode in environment >>>>> File "/home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py" >>>>> <http://127.0.0.1:8000/admin/default/edit/bikend/models/db.py>, line 586, >>>>> in <module> >>>>> print db(db.test_geo.id>0).select(db.test_geo.id, dist) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 8975, in select >>>>> return adapter.select(self.query,fields,attributes) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1636, in select >>>>> return self._select_aux(sql,fields,attributes) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1601, in >>>>> _select_aux >>>>> self.execute(sql) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1714, in >>>>> execute >>>>> return self.log_execute(*a, **b) >>>>> File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1708, in >>>>> log_execute >>>>> ret = self.cursor.execute(*a, **b) >>>>> ProgrammingError: function st_astext(double precision) does not exist >>>>> LINE 1: SELECT test_geo.id, ST_AsText(ST_Distance(test_geo<span >>>>> style="color: #660;"... >>>>> Show original >>>>> <https://groups.google.com/group/web2py/msg/6ff54d463de23269?dmode=source&output=gplain&noredirect> >>>>> >>>>> --

