I believe the spatial DAL only supports postgresql/postGIS and sqlite/spatialite. It does not support mysql.
On Monday, 1 October 2012 13:15:07 UTC-5, Calvin wrote: > > Thanks for your suggestion Manuele. I have installed GDAL and also tried > point 1, but then I get stuck as web2py throws the following error: > > Traceback (most recent call last): > File "/var/www/web2py/gluon/restricted.py", line 209, in restricted > exec ccode in environment > File "/usr/share/web2py/applications/hello_world/models/db.py" > <https://3vialy.com/admin/default/edit/3v2/models/db.py>, line 132, in > <module> > migrate=True > File "/var/www/web2py/gluon/dal.py", line 7033, in define_table > table = self.lazy_define_table(tablename,*fields,**args) > File "/var/www/web2py/gluon/dal.py", line 7064, in lazy_define_table > polymodel=polymodel) > File "/var/www/web2py/gluon/dal.py", line 784, in create_table > srid = self.srid > AttributeError: 'MySQLAdapter' object has no attribute 'srid' > > > when I set migrate=True. Apparently, the fieldtype starting with 'geo' is > causing an issue. Any further clues? > > many thanks > Calvin > > > - > > > On Thursday, 27 September 2012 18:14:49 UTC+8, Manuele wrote: >> >> Il 27/09/2012 05:02, Calvin ha scritto: >> > Hi >> > >> > I am a big fan of Web2py and would like to use the DAL for capturing >> > location specific information. I use MySQL as a back-end and would >> > like to understand how I could define a table with MySQL's Spatial >> > Extension data types into the DAL and hopefully be able to access this >> > with SQLFORM. For instance, how could I get the DAL to define a field >> > as a WKT point? >> >> as long as I have tested you can: >> >> 1) define your table with geometry: >> >> db.define_table('mytab' >> Field('geometry_name'), >> Field('the_geom', 'geometry()') >> ) >> >> 2) than you can insert geometries in this way: >> >> info = dict( >> geometry_name = 'test', >> the_geom = 'POINT(0 0)' >> ) >> >> db.mytab.insert(**info) >> >> I suggest you to manage your geometries using the power of python-gdal >> useful for wkt/b conversion and not only >> >> hope it could help >> >> Cheers >> >> Manuele >> >> >> >> > Many thanks >> > Calvin >> > -- >> > >> > >> > >> >> --