<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;}
p.yiv1051054434msonormal, li.yiv1051054434msonormal, div.yiv1051054434msonormal
        {mso-style-name:yiv1051054434msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.yiv1051054434msochpdefault, li.yiv1051054434msochpdefault, div.yiv1051054434msochpdefault
        {mso-style-name:yiv1051054434msochpdefault;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.yiv1051054434msonormal1, li.yiv1051054434msonormal1, div.yiv1051054434msonormal1
        {mso-style-name:yiv1051054434msonormal1;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.yiv1051054434msochpdefault1, li.yiv1051054434msochpdefault1, div.yiv1051054434msochpdefault1
        {mso-style-name:yiv1051054434msochpdefault1;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Times New Roman",serif;}
span.yiv1051054434msohyperlink
        {mso-style-name:yiv1051054434msohyperlink;}
span.yiv1051054434msohyperlinkfollowed
        {mso-style-name:yiv1051054434msohyperlinkfollowed;}
span.yiv1051054434shkpostityyli17
        {mso-style-name:yiv1051054434shkpostityyli17;}
span.yiv1051054434shkpostityyli18
        {mso-style-name:yiv1051054434shkpostityyli18;}
span.yiv1051054434msohyperlink1
        {mso-style-name:yiv1051054434msohyperlink1;
        color:blue;
        text-decoration:underline;}
span.yiv1051054434msohyperlinkfollowed1
        {mso-style-name:yiv1051054434msohyperlinkfollowed1;
        color:purple;
        text-decoration:underline;}
span.yiv1051054434shkpostityyli171
        {mso-style-name:yiv1051054434shkpostityyli171;
        color:#1F497D;}
span.yiv1051054434shkpostityyli181
        {mso-style-name:yiv1051054434shkpostityyli181;
        color:windowtext;}
span.Shkpostityyli29
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.Shkpostityyli30
        {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">If your version and environment requires escaping, then you need to do<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">"select geometry, \"building\" as bldg,\"building:levels\" as bldg_levels,\”height\” as height from multipolygons ...
 "<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">It may work also without escaping as<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">"select geometry, "building" as bldg,"building:levels" as bldg_levels,height as height from multipolygons ... "<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">If you plan to follow the SQL route I really recommend you to read some SQL tutorials and exercise at home. I am sure
 that you will learn the basics soon and tutorials are always in the web while I am not. SQL is so close to English and that you can think that you are making a (comma separated) shopping list<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">“SELECT milk,bread,juice FROM Wal-Mart”.<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">-Jukka-<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"><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"><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"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Lähettäjä:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Djordje Spasic [<a href="mailto:issworld2000@yahoo.com">mailto:issworld2000@yahoo.com</a>]
<br>
<b>Lähetetty:</b> 14. marraskuuta 2016 17:21<br>
<b>Vastaanottaja:</b> Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>>;
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Aihe:</b> Re: VS: [gdal-dev] How to replace an osm key?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div id="yui_3_16_0_ym19_1_1479135998950_10027">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">Thank you Jukka,<br>
<br>
How should I edit the command you gave me:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt" id="yui_3_16_0_ym19_1_1479135998950_11970">
<div id="yui_3_16_0_ym19_1_1479135998950_10081">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">"C:\gdal\ogr2ogr.exe" --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"
<b id="yui_3_16_0_ym19_1_1479135998950_12008">-dialect sqlite -sql "select geometry, \"building\" as bldg from multipolygons where \"building\" is not null limit 1"</b> "C:\output_shp_files" "C:\input.osm"<o:p></o:p></span></p>
</div>
</blockquote>
<div id="yui_3_16_0_ym19_1_1479135998950_11918">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black">so that "building", "building:levels", and "height" fields are included, not only the "building" field?<o:p></o:p></span></p>
</div>
<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 lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">On Monday, November 14, 2016 2:10 PM, Rahkonen Jukka (MML) <</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black"><a href="mailto:jukka.rahkonen@maanmittauslaitos.fi"><span lang="EN-US">jukka.rahkonen@maanmittauslaitos.fi</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">>
 wrote:</span><span lang="EN-US" 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 lang="EN-US" style="font-family:"Helvetica",sans-serif;color:black"><o:p> </o:p></span></p>
<div>
<div id="yiv1051054434">
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">Hi,</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">If you enclose something between single quotes in SQL it becomes a string. 
</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">SELECT ’building’  -> selects literally the given *<b>string</b>* –building—</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">However,</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">SELECT "building" -> selects the *<b>value</b>* of *<b>field</b>* –building-- (or “identifier” as is it called in SQL)</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">See for example
<a href="https://www.sqlite.org/lang_keywords.html" target="_blank">https://www.sqlite.org/lang_keywords.html</a></span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">I tested on Windows with trunk version of GDAL that this syntax works:</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">ogrinfo -dialect sqlite -sql "select geometry, "building" as bldg
</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">from multipolygons where "building" is not null limit 1" hamburg-latest.osm.pbf</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">By reading this old thread
<a href="http://osgeo-org.1560.x6.nabble.com/gdal-dev-OGR-SQL-Excecuting-select-where-column-name-contains-quot-quot-td5006377.html" target="_blank">
http://osgeo-org.1560.x6.nabble.com/gdal-dev-OGR-SQL-Excecuting-select-where-column-name-contains-quot-quot-td5006377.html</a> some older GDAL versions may need some more tweaking and inner double quotes must be escaped by back slash as \”</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">ogrinfo -dialect sqlite -sql "select geometry, \"building\" as bldg
</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">from multipolygons where \"building\" is not null limit 1" hamburg-latest.osm.pbf</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black">-Jukka Rahkonen-</span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:11.0pt;font-family:"Helvetica",sans-serif;color:black"> </span><span style="font-family:"Helvetica",sans-serif;color:black"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>