I am reading in GML data to a specified PostGIS schema. This is part of an automated job so and the db table might include views so I don't want to drop the table each time the script is run.
EDIT: It append and truncate works if I dont specify the schema. But in my workflow I have to use a specified schema.
Trying to do this:
Typical use case: “ogr2ogr -append PG:dbname=foo abc.shp –config OGR_TRUNCATE YES
ogr2ogr -append -f "PostgreSQL" PG:"host=localhost user=postgres dbname=geospatial password=postgres" \
-lco SCHEMA=test \
-lco GEOMETRY_NAME=geom \
"C:\Users\my_GML.gml" \
–config OGR_TRUNCATE YES
This result in ERROR 1: Couldn't fetch requested layer '–-config'!
????
EDIT: Double dash is the correct way –-config OGR_TRUNCATE YES
In addition if I run a standard append version
ogr2ogr -append -f "PostgreSQL" PG:"host=localhost user=postgres dbname=geospatial password=postgres" \
-lco SCHEMA=test \
-lco GEOMETRY_NAME=geom \
"C:\Users\myGML.gml"
ERROR 1: Layer test.mylayer already exists, CreateLayer failed.
Use the layer creation option OVERWRITE=YES to replace it.
What am I doing wrong?
–config OGR_TRUNCATE=YES