I'm trying to use spatialite to add a geometry column to an existing sqlite3 table. Can I simply call "select initspatialmetadata()" on my existing database and then AddGeometryColumn on my existing table? Or do I need to drop the table? Or do I need to start a new database entirely and call initspatialmetadata immediately (or alternatively create the database with the spatialite cli)?
Asked
Active
Viewed 173 times
-1
-
1Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 17 '22 at 06:34
1 Answers
0
You wanted to add new geometry column on existing table of spatialite
database.
There are few points that I wanted to highlight to you
sqlite> select InitSpatialMetaData();
The InitSpatialMetaData() function must be called immediately after creating a new database, and before attempting to call any other Spatial SQL function.
The scope of this function is exactly the one to create (and populate) any metadata table internally required by SpatiaLite.
If any metadata table already exist, this function doesn't apply any action at all. So, calling more times InitSpatialMetaData() is useless but completely harmless.
And lastly, I had never tried it before. But I think, you can add a new column on your existing table using AddGeometryColumn. Why not try to do this.

Sawan Meshram
- 230
- 2
- 12