1

I have several (100+) .kmz files that I would like to import into my PostgreSQL database. I have this ogr2ogr command that works fine getting it into the database, but creates a new table every time:

C:\Radio Stations>ogr2ogr -f "PostgreSQL" PG:"host=localhost user=postgres dbname=postgres password=password port=5433" "file.kmz"

What do I put in that cmd to put all of the .kmz files into the same table?

I'm using PostGIS 2.2.1, PostgreSQL 9.5.1, Python 3.6.1

  • use -update to load to one table using many file as the source. gdal.org/ogr2ogr.html – Mapperz Jul 10 '17 at 18:10
  • C:\Radio Stations>ogr2ogr -update -append -f "PostgreSQL" PG:"host=localhost user=postgres dbname=postgres password=passw port=5433" "file.kmz" still adds another table, am I doing something wrong? – Matt Jul 10 '17 at 18:27
  • you are probably not setting the table try using '-nln mytable' – Mapperz Jul 10 '17 at 19:17
  • Can you please answer your own question for future visitors? Thanks! @Matt – Alex Leith Jul 11 '17 at 8:10
  • @Mapperz if you would like to answer this question, I'll give you credit. – Matt Jul 11 '17 at 12:38
1

The Table name needs to be set in the command to load many kmz into one table.

C:\Radio Stations>ogr2ogr -f "PostgreSQL" PG:"host=localhost user=postgres dbname=postgres password=password port=5433" "file.kmz" -nln mytable

-nln mytable command will specify a table name to load into.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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