I use shp2pgsql to append a shapefile to an existing table.

How can I define the table where I want to append the shapefile in PostGIS?

This is the command I execute with Python:

command = "shp2pgsql -s 4326 -a shape_file.shp | psql -h localhost -p 5432 -d gis_exercise -U postgres" 

But this commands generates a table with the name of the shapefile.

1 Answer 1


You should add the schemaname and tablename to the command. Like this:

shp2pgsql -s 4326 -I [naam].shp [schemaname].[tablename]  | psql -h [host] -d [database] -U [user]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.