1

I'm trying to script the import of a KMZ file into my PostGIS 2.2.1 enabled PostgreSQL 9.5.1 database and am running into a problem where it's not importing all of the (several dozen) layers. I think it's because within the KMZ file, there's another KMZ file and it's tripping the import up. Below is the command, but my question is: is there a way to exclude certain layers/files within the KMZ during the import process?

ogr2ogr -overwrite -f "PostgreSQL" PG:"host='hostname' user=postgres dbname='databaseName' schemas=schemaName password=pw" -nln "tableName" "path\to\file\filename.kmz"

I see where you can select certain fields within each layer using the -select trigger, but is there something similar for entire layers?

here's what the unzipped kmz looks like in QGIS:

enter image description here

  • Unlikely that there's another KMZ inside the first KMZ. You can check by unzipping the KMZ and inspecting it. – nmtoken Nov 13 '19 at 17:10
  • Could it be instead that one or more of the KML layers is actual an image, or a reference to an image service, and not an importable vector dataset? – nmtoken Nov 13 '19 at 17:12
  • unfortunately there's definitely another kmz inside the kmz. I'll add a picture to the question. These are vector lines that aren't being imported. – Matt Nov 13 '19 at 17:38
  • How does ogrinfo see the layers? – user30184 Nov 14 '19 at 8:56
  • @user30184 ogrinfo filename.kmz displays the same layers (including the .kmz), just not in alphabetical order. – Matt Nov 14 '19 at 13:05

Your Answer

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

Browse other questions tagged or ask your own question.