Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Skip a specified input layer in ogr2ogr

$
0
0

I am using ogr2ogr to load data from multiple GML files into PostGIS. As shown in the ogrinfo output below, each GML file has multiple layers.

    Had to open data source read-only.
INFO: Open of `D:ProjectsosmapsdatavectorMapDistrict_unzippedHP40.gml'
      using driver `GML' successful.
1: Ornament (Polygon)
2: SurfaceWater_Line (Line String)
3: TidalWater (Polygon)
4: SpotHeight (Point)
5: TidalBoundary (Line String)
6: FunctionalSite (Point)
7: SurfaceWater_Area (Polygon)
8: Road (Line String)
9: Foreshore (Polygon)
10: AdministrativeBoundary (Line String)
11: NamedPlace (Point)
12: Building (Polygon)

I want to load all layers except the Ornament layer. How do I get ogr2ogr to skip the specific layer?

My current script in Windows Powershell:

# Input gml directory
$gmlDir = "D:ProjectsosmapsdatavectorMapDistrict_unzipped"
# Loop through gml files
Foreach($gmlFile in Get-ChildItem $gmlDir -filter *.gml) {
    #Load data
    ogr2ogr -f PostgreSQL PG:"dbname=osmaps host=localhost port=5432 active_schema=vectormapdistrict user=postgres" -append -progress --config PG_USE_COPY YES $gmlFile.fullname}

Viewing all articles
Browse latest Browse all 397

Trending Articles