3

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

asked Jul 10, 2017 at 17:06
5
  • use -update to load to one table using many file as the source. gdal.org/ogr2ogr.html Commented Jul 10, 2017 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? Commented Jul 10, 2017 at 18:27
  • you are probably not setting the table try using '-nln mytable' Commented Jul 10, 2017 at 19:17
  • Can you please answer your own question for future visitors? Thanks! @Matt Commented Jul 11, 2017 at 8:10
  • @Mapperz if you would like to answer this question, I'll give you credit. Commented Jul 11, 2017 at 12:38

1 Answer 1

3

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.

answered Jul 11, 2017 at 15:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.