[GIS] Moving SpatiaLite Table into PostgreSQL using ogr2ogr

ogr2ogrpostgispostgresqlspatialite

How can I move a Spatialite table from a Spatialite db to a PostgreSQL db using ogr2ogr?

Best Answer

And, after a bit more reading the ogr2ogr help I found the answer more easily than I expected.

ogr2ogr -f "PostgreSQL" PG:"dbname=db" spatialitedb -sql "SELECT * FROM table" -dialect spatialite -nln new_table

EDIT: As suggested by user30184 in the comments a cleaner, simpler method is:

ogr2ogr -f "PostgreSQL" PG:"dbname=db" spatialitedb spatialite_table_name
Related Question