[GIS] How to create temporary tables in spatialite

spatialitesqlite

How do you create a temporary table with geometry column in spatialite?

I have tried:

CREATE TEMP TABLE rivers (code INTEGER, id INTEGER, name TEXT);

Followed by:

SELECT AddGeometryColumn('temp.rivers','geom', 27700, LINESTRING');

The first query succesfully creates the table, but the second query does not create the geometry column. I have tried running the queries in spatialite-gui, and in python with the sqlite3 module, with the same results.

Best Answer

I do not believe that the AddGeometryColumn part is possible at all. This thread tells that it is not possible to use it for attached databases https://groups.google.com/forum/#!topic/spatialite-users/rRMSHk2Lt38 and the temporary database is an attached, automatically created database. You must create your temporary tables into the main database and drop them once you do not need them any more.

Related Question