2

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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 1, 2016 at 9:31

1 Answer 1

3

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'))
answered Jul 1, 2016 at 10:08
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.