Hi Nikos, I think it would be quite easy to hack up a python script that generates a osmconf.ini with the configparser module and calls ogr2ogr via subprocess to process the data, but I don’t have done anything in that regard yet. I don’t remember exactly anymore why I chose osmconvert over ogr2ogr for extracting a subregion from a larger PBF. But as far as I remember osmconvert was superior in speed and accuracy for that task than ogr2ogr.
Dipl. Geogr. Frank Broniewski Waldhölzbacher Str. 51 66679 Losheim am See 06872 5090684 www.frankbroniewski.com Von: Nikos Alexandris Gesendet: Mittwoch, 8. November 2017 11:38 An: Frank Broniewski Cc: [email protected] Betreff: Re: AW: [gdal-dev] Extracting keys & values from OSM Planet Frank Broniewski: >Hi Nikos, > >I am using a similar approach to yours to extract data from OSM files >to a GIS format. I chose Spatiallite as a format since it is superior >to the Shapefile format in all areas. FYI here’s what I do: >osmconvert -b="5.5,49,8,50.5" -o=saarland.osm.pbf "europe-latest.osm.pbf" >ogr2ogr --config OSM_CONFIG_FILE /home/frank/gdal/osmconf.ini -f SQLite -dsco >SPATIALITE=YES -progress -gt 65536 -t_srs "EPSG:31466" >/tmp/saarland.sqlite >/tmp/saarland.osm.pbf >Please note the “–config” switch for a custom osmconf.ini. With that >you can copy the config to a custom location and have several configs >for many use cases. Thank you Even and Frank! I will likely adopt the `osmconf.ini` method. @Frank, I would go a step further if time permits. A function or script that takes something like `layer=lines` and `keys="track,footway,bridleway,path"` as input parameters and outputs the custom configuration file. >From reading the driver's manual [0], there is a hint about the spatial, filtering resulting in lines or polygons missing vertices. Is this a/the reason, to stick to `osmconvert` for extracting areas of interest? Thank you for your (invaluable) time, Nikos [0] http://www.gdal.org/drv_osm.html
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
