I have a postgis table created by importing a shapefile containing land parcels. The county releases a new shapefile containing updated data monthly and I want to incorporate that into my database.
The original data was uploaded using QGIS' database manager plugin. I'm fairly new to postgis.
I have views based on the data, so dropping the table and re-uploading isn't a great option. What I did last time was to use a DELETE command to completely empty the table then uploading the shapefile into a temporary table and using a INSERT * INTO ... command to copy all the data over.
This seems like a cumbersome process to go through monthly, especially since only a small percent of the data changes. Is there a better way to go about this?
1 Answer 1
You can use --config OGR_TRUNCATE YES
and also from reading the comments, try using the option -unsetFieldWidth
OGR_TRUNCATE config option won't actually delete the table, is will delete all the records in the table. This will make it so VIEWS and other stuff in the database that rely on that table won't have dependency issues.
unsetFieldWidth option sets the width and precision of certain fields to 0 or simply tells it to ignore hard coded constraints that might limit features from being imported because they are "too long".
lco PRECISION=NO
which would not create attributes as fixedNUMERIC(width,precision)
. See gdal.org/drv_pg.html. Anyway, Shape_area is IMHO rather useless attribute outside ESRI landscape and the loss in accuracy you are getting now because of truncated numbers may not be important for you.