I am working with a Spatialite database and a series of shapefiles. I have an empty spatialite table that has geometry and columns. What I would like to do is to load the shapefiles into the spatialite table (Append) but I am unsure if this is possible with Spatialite. I do not see an option with the Spatialite-GUI, or the QGIS plugin. Does anyone have any ideas or tricks the a SQL query?
Thanks…
EDIT
I would like to add a SELECT statement so that I only get selected rows
Best Answer
So given a table with four explicit columns - City, State and Country, plus geom:
We want to take a source of places (I used Natural Earth, 1:50m, because it was already handy from another question).
We can do the import in a range of ways, but a Spatialite Virtual Table (supporting shapefile) is among the easiest.
Lets see what is now available:
OK, but we don't want all of those columns. Country and state are ambiguous, but I'll assume you meant something like administrative regions:
We can also select only a subset of those cities (say, all the places where the megacity column value is 1):
Now to import that subset of places into our table, we use a SQLite INSERT INTO command:
Now we can check the results:
Obviously the WHERE could be any criteria you need.