Closed mrahiz closed 4 years ago
You could use the argument partial.match = TRUE
to insert only on the columns that have matching names between the existing PostGIS table and the data frame. Note that matching is case-sensitive. In your example, only the column id
would transfer.
Also, if your existing PostGIS table has a geometry column, you can just insert the shape
Spatial*DataFrame directly, e.g.:
shape <- readOGR(dsn=location,layer="input_shapefile")
pgInsert(con,name=c("master","bounding_box"),data.obj=shape, partial.match = TRUE)
Closing it, as there is no activity, and it seems the issue was addressed.
I received the following error when trying to import an ESRI shapefile using pgInsert into a table in my database:
My table has the following fields: id, description and geom, whereas my shapefile has the following: FID, shape and id.
Am I missing an argument or a step that triggers the error message?
My code is as follows: