So I have a shapefile with several columns:
I also have an existing PostGIS table on my remote server:
What I want to achieve
Now I would like to
INSERT data from the shapefile into my PostGIS table. However, I only need specific columns from it (namely the
geometry). The remaining columns in my PostGIS table have a
DEFAULT or are nullable.
What I have tried
I had a look into
ogr2ogr but it seems that I cannot do my above query without creating a new table. It seems the only option I have is to drop all columns from the shapefile that I don't need, rename the columns to match the column names of the PostGIS table, and use the
-a flag of
shp2pgsql to insert the data into my table. (or using tools like FME)
Is there perhaps a more elegant way to do this?