<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=DE link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-GB>Hi Nikos,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>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.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Dipl. Geogr. Frank Broniewski<br>Waldhölzbacher Str. 51<br>66679 Losheim am See<br>06872 5090684<br>www.frankbroniewski.com</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>Von: </b><a href="mailto:nik@nikosalexandris.net">Nikos Alexandris</a><br><b>Gesendet: </b>Mittwoch, 8. November 2017 11:38<br><b>An: </b><a href="mailto:frank.broniewski@gmail.com">Frank Broniewski</a><br><b>Cc: </b><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><b>Betreff: </b>Re: AW: [gdal-dev] Extracting keys & values from OSM Planet</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Frank Broniewski:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>>Hi Nikos,</p><p class=MsoNormal>><o:p> </o:p></p><p class=MsoNormal>>I am using a similar approach to yours to extract data from OSM files</p><p class=MsoNormal>>to a GIS format. I chose Spatiallite as a format since it is superior</p><p class=MsoNormal>>to the Shapefile format in all areas.  FYI here’s what I do:</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>>osmconvert -b="5.5,49,8,50.5" -o=saarland.osm.pbf "europe-latest.osm.pbf"</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>>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</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>>Please note the “–config” switch for a custom osmconf.ini. With that</p><p class=MsoNormal>>you can copy the config to a custom location and have several configs</p><p class=MsoNormal>>for many use cases.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thank you Even and Frank!</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I will likely adopt the `osmconf.ini` method.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>@Frank, I would go a step further if time permits. A function or script that</p><p class=MsoNormal>takes something like `layer=lines` and</p><p class=MsoNormal>`keys="track,footway,bridleway,path"` as input parameters and outputs the</p><p class=MsoNormal>custom configuration file.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>From reading the driver's manual [0], there is a hint about the spatial,</p><p class=MsoNormal>filtering resulting in lines or polygons missing vertices. Is this a/the</p><p class=MsoNormal>reason, to stick to `osmconvert` for extracting areas of interest?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thank you for your (invaluable) time, Nikos</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>[0] http://www.gdal.org/drv_osm.html</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>