16

I have already created a geometry table in postgis. I want to load several shapefiles into that table using ogr2ogr. But I didn't find the parameter which could specify that table.

ogr2ogr -append -f "PostgreSQL" PG:"dbname=db and so on" shapefile.shp 

That's it. How can I add some parameter to specify the table?

2 Answers 2

21

To be explicit about nickves' answer:

ogr2ogr -append -f "PostgreSQL" PG:"dbname=db" shapefile.shp -nln mytable 
1
  • 1
    (-nln is also working for appending to existing tables in geopackages)
    – Bera
    Commented Apr 13, 2021 at 9:13
12

http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet

use the flag -nln to specify the name of your target table

1
  • 2
    Another Question regarding that: Can I add some parameter using this command. Such as the user defined ID ?
    – Yu Guo
    Commented May 15, 2013 at 17:09

Your Answer

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

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