I'm trying to create a geometry column in a table which I created.
I found the following code:
cur.execute('SELECT addgeometrycolumn(%s, %s, %s, %s, %s)' %(table_name, geometry_column_name, EPSGcode, 'POLYGON', 'XYZ'))
but I always get the same error : no such column table_name
It seems that the addgeometrycolumn is not the same function that the one I found during my research. So please can someone help me to add a geometric column to an existing table?
1 Answer 1
The Example from the spatialite cookbook https://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/new-geom.html denotes:
SELECT AddGeometryColumn('test_geom', 'the_geom', 4326, 'POINT', 'XY');
Strings are quoted here, so try to modify your comand to
cur.execute("SELECT AddGeometryColumn('%s', '%s', %s, '%s', '%s')" %(table_name, geometry_column_name, EPSGcode, 'POLYGON', 'XYZ'))