<html xmlns:v="urn:schemas-microsoft-com:vml" 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:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@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;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.Shkpostityyli17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Ogrinfo and ogr2ogr usually accept the same syntax and therefore I gave the ogrinfo example. I apologize, it can’t be
self-evident for all GDAL users.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">You can do the whole thing with one command like this:
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"
<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">-dialect sqlite –sql "select geometry, building as bldg from multipolygons” output.shp input.osm<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">You must edit the SQL parameter to include all the fields that you want to get into the result "select geometry, building
as bldg, another_attribute as attr_2 …” and you must run the query separately for all the layers ( points, lines, multilinestrings, multipolygons).<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Djordje Spasic wrote:<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">Hi Jukka,<br id="yui_3_16_0_ym19_1_1478869614109_14825">
<br>
<o:p></o:p></span></p>
<div id="yui_3_16_0_ym19_1_1478869614109_14827">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">Thank you for the quick and informative reply!<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1478869614109_14828">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">But I am not sure I understood you.<br id="yui_3_16_0_ym19_1_1478869614109_14830">
<br id="yui_3_16_0_ym19_1_1478869614109_14831">
So first I need to convert the .osm file to .shp files with ogr2ogr.exe<o:p></o:p></span></p>
<div id="yui_3_16_0_ym19_1_1478869614109_14833">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">And then I am calling the ogrinfo.exe on specific .shp file (multipolygons.dbf ?)<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1478869614109_14834">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt" id="yui_3_16_0_ym19_1_1478869614109_14836">
<div id="yui_3_16_0_ym19_1_1478869614109_14837">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile" output.shp input.osm<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1478869614109_14838">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1478869614109_14840">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">ogrinfo.exe -dialect sqlite -sql "select geometry, building as bldg
<br id="yui_3_16_0_ym19_1_1478869614109_14841">
from output.shp/multipolygons.dbf" input.osm.pbf<o:p></o:p></span></p>
</div>
</blockquote>
<div id="yui_3_16_0_ym19_1_1478869614109_14842">
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">?
<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">On Friday, November 11, 2016 2:36 PM, jratike80 <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>>
wrote:</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:"Helvetica",sans-serif;color:black"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:"Helvetica",sans-serif;color:black">Hi,<br>
<br>
You can rename the fields with SQL<br>
<br>
ogrinfo -dialect sqlite -sql "select geometry, building as bldg <br>
from multipolygons" hamburg-latest.osm.pbf<br>
<br>
....<br>
Geometry Column = GEOMETRY<br>
bldg: String (0.0)<br>
....<br>
<br>
Slight drawback is that you must include all the attributes in SELECT but<br>
you can save the command into text file for reuse.<br>
<br>
-Jukka Rahkonen-<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/gdal-dev-How-to-replace-an-osm-key-tp5295339p5295342.html" target="_blank">
http://osgeo-org.1560.x6.nabble.com/gdal-dev-How-to-replace-an-osm-key-tp5295339p5295342.html</a><br>
Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>