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.htmlMapperz– Mapperz ♦2017年07月10日 18:10:15 +00:00Commented 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?Matt– Matt2017年07月10日 18:27:03 +00:00Commented Jul 10, 2017 at 18:27
-
you are probably not setting the table try using '-nln mytable'Mapperz– Mapperz ♦2017年07月10日 19:17:06 +00:00Commented Jul 10, 2017 at 19:17
-
Can you please answer your own question for future visitors? Thanks! @MattAlex Leith– Alex Leith2017年07月11日 08:10:00 +00:00Commented Jul 11, 2017 at 8:10
-
@Mapperz if you would like to answer this question, I'll give you credit.Matt– Matt2017年07月11日 12:38:28 +00:00Commented Jul 11, 2017 at 12:38
1 Answer 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.