diff --git a/test/basic_geometries_filterlayer.pbf.xml b/test/basic_geometries_filterlayer.pbf.xml new file mode 100644 index 0000000..2760dda --- /dev/null +++ b/test/basic_geometries_filterlayer.pbf.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/basic_geometries_filterlayer.xml b/test/basic_geometries_filterlayer.xml new file mode 100644 index 0000000..a12815b --- /dev/null +++ b/test/basic_geometries_filterlayer.xml @@ -0,0 +1,3 @@ + + + diff --git a/test/osm_output.t b/test/osm_output.t index fa2619c..10c2895 100644 --- a/test/osm_output.t +++ b/test/osm_output.t @@ -566,3 +566,15 @@ shiftjis: Writing file footer $ xmllint --format shift-jis.osm | diff -uNr - $TESTDIR/shift-jis.xml +basicgeometriesfilterlayer: + $ ogr2osm -t $TESTDIR/translations/filterlayer-translation.py -f $TESTDIR/shapefiles/basic_geometries.kml + Found valid translation class FilterLayerTranslation + Preparing to convert .* (re) + Splitting long ways + Writing file header + Writing nodes + Writing ways + Writing relations + Writing file footer + $ xmllint --format basic_geometries.osm | diff -uNr - $TESTDIR/basic_geometries_filterlayer.xml + diff --git a/test/pbf_output.t b/test/pbf_output.t index 8c75479..9fdd62d 100644 --- a/test/pbf_output.t +++ b/test/pbf_output.t @@ -526,3 +526,15 @@ shiftjis: \[.[0-9]\] (re) $ xmllint --format shift-jis.osm | diff -uNr - $TESTDIR/shift-jis.pbf.xml +basicgeometriesfilterlayer: + $ ogr2osm --pbf -t $TESTDIR/translations/filterlayer-translation.py -f $TESTDIR/shapefiles/basic_geometries.kml + Found valid translation class FilterLayerTranslation + Preparing to convert .* (re) + Splitting long ways + Writing file header + Writing nodes + Writing ways + Writing relations + $ osmconvert --drop-author basic_geometries.osm.pbf > basic_geometries.osm 2> /dev/null + $ xmllint --format basic_geometries.osm | diff -uNr - $TESTDIR/basic_geometries_filterlayer.pbf.xml + diff --git a/test/translations/filterlayer-translation.py b/test/translations/filterlayer-translation.py new file mode 100644 index 0000000..af09246 --- /dev/null +++ b/test/translations/filterlayer-translation.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +''' +Copyright (c) 2012-2021 Roel Derickx, Paul Norman , +Sebastiaan Couwenberg , The University of Vermont +, github contributors + +Released under the MIT license, as given in the file LICENSE, which must +accompany any distribution of this code. +''' + +import ogr2osm, logging + +class FilterLayerTranslation(ogr2osm.TranslationBase): + def __init__(self): + self.logger = logging.getLogger('ogr2osm') + + + def filter_layer(self, layer): + # suppress all layers + return None