<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="text/html; charset=utf-8">
</head>
<body>
<div>
<div style="font-family:Calibri,sans-serif; font-size:11pt">Hi,<br>
<br>
Related to your previous question, you can use SQL select only for fields which are included in osmconf.ini. Perhaps "height" is not. 'building:levels' may make a surprise for you, if ogr2ogr follows SQL specification it will select a fixed string. You should
 use double quotes instead and they may require escaping but I do not remember with which character. Start with easy test and more attributes with odd names one by one.<br>
<br>
-Jukka-<br>
</div>
</div>
<div dir="ltr">
<hr>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Lähettäjä:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:issworld2000@yahoo.com">Djordje Spasic</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Lähetetty:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">‎12.‎11.‎2016 3:37</span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Vastaanottaja:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">Rahkonen Jukka (MML)</a>;
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></span><br>
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Aihe:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">Re: VS: [gdal-dev] How to replace an osm key?</span><br>
<br>
</div>
<div>
<div style="color:#000; background-color:#fff; font-family:verdana,helvetica,sans-serif; font-size:13px">
<div><span></span></div>
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_12701" style="color:#000; background-color:#fff; font-family:verdana,helvetica,sans-serif; font-size:13px">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_6951"><span></span></div>
<div class="yiv0347963161qtdSeparateBR" id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_12791">
Hi Jukka,<br>
<br>
<div dir="ltr" id="yui_3_16_0_ym19_1_1478907638248_7336">I have just tried to rename the fields with SQL. Here is the syntax:</div>
<blockquote id="yui_3_16_0_ym19_1_1478907638248_9241">
<div dir="ltr" id="yui_3_16_0_ym19_1_1478907638248_7338">"C:\gdal\ogr2ogr.exe" --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"
<b id="yui_3_16_0_ym19_1_1478907638248_9338">-dialect sqlite -sql "select geometry, building as bldg, 'building:levels' as bldg_level, height as height from multipolygons"</b> output_shps input.osm</div>
</blockquote>
<div dir="ltr" id="yui_3_16_0_ym19_1_1478907638248_9230">It raises the following error message:</div>
<blockquote id="yui_3_16_0_ym19_1_1478907638248_11287">
<div dir="ltr" id="yui_3_16_0_ym19_1_1478907638248_11219"><font id="yui_3_16_0_ym19_1_1478907638248_15015" color="#4c76a2">ERROR 1: In ExecutableSQL<>: sqlite3_prepare<select geometry, building as bldg, 'building:levels' as bldg_level, height as height from
 multipolygons>:<br id="yui_3_16_0_ym19_1_1478907638248_11272">
no such column: height</font><br>
</div>
</blockquote>
<div dir="ltr" id="yui_3_16_0_ym19_1_1478907638248_11169">Interestingly when I convert an .osm file to .shp files without using the SQL syntax, then the multipolygons.shp file does contain the "height" field. Not all shapes inside it contain it, but some do.<br>
<br>
So why is the upper <i id="yui_3_16_0_ym19_1_1478907638248_13178">"no such column: height"</i> error message raised?<br>
<br>
Is something wrong with the SQL syntax?<br>
<br>
Thank you for the reply.<br>
<br>
Kind regards,<br>
Djordje<br>
<br>
</div>
----------------------------<br clear="none">
</div>
</div>
<div class="qtdSeparateBR"><br>
<br>
</div>
<div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1478907638248_7157" style="display:block">
<div id="yui_3_16_0_ym19_1_1478907638248_7156" style="font-family:verdana,helvetica,sans-serif; font-size:13px">
<div id="yui_3_16_0_ym19_1_1478907638248_7155" style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size:16px">
<div class="y_msg_container" id="yui_3_16_0_ym19_1_1478907638248_7154">
<div id="yiv0347963161">
<div id="yui_3_16_0_ym19_1_1478907638248_7153">
<div id="yui_3_16_0_ym19_1_1478907638248_7152" style="color:#000; background-color:#fff; font-family:verdana,helvetica,sans-serif; font-size:13px">
<div id="yiv0347963161">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_15993">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_15992" style="color:#000; background-color:#fff; font-family:verdana,helvetica,sans-serif; font-size:13px">
<div class="yiv0347963161yqt9896827236" id="yiv0347963161yqt02075">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16019">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16018" style="font-family:verdana,helvetica,sans-serif; font-size:13px">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16017" style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size:16px">
<div class="yiv0347963161yqt7836308091" id="yiv0347963161yqt53630">
<div dir="ltr" id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16057"><font id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16056" size="2" face="Arial">On Friday, November 11, 2016 6:46 PM, Rahkonen Jukka (MML) <jukka.rahkonen@maanmittauslaitos.fi> wrote:<br clear="none">
</font></div>
<br clear="none">
<br clear="none">
<div class="yiv0347963161y_msg_container" id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16061">
<div id="yiv0347963161">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16060">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16059">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16058" style="font-family:Calibri,sans-serif; font-size:11pt">
Hi,<br clear="none">
<br clear="none">
If you select geometry and attribute "foo" that's all you get. If you want attribute "bar" as well you must do "select geometry,foo,bar from your_table". That is plain SQL, you will find tutorials from the web.<br clear="none">
<br clear="none">
-Jukka-<br clear="none">
</div>
</div>
<div class="yiv0347963161yqt0872194206" id="yiv0347963161yqt50484">
<div dir="ltr" id="yui_3_16_0_ym19_1_1478907638248_7217">
<hr id="yui_3_16_0_ym19_1_1478907638248_11170">
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Lähettäjä:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a rel="nofollow" shape="rect" target="_blank" href="mailto:issworld2000@yahoo.com">Djordje Spasic</a></span><br clear="none">
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Lähetetty:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt">‎11.‎11.‎2016 19:10</span><br clear="none">
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Vastaanottaja:
</span><span style="font-family:Calibri,sans-serif; font-size:11pt"><a rel="nofollow" shape="rect" target="_blank" href="mailto:jukka.rahkonen@maanmittauslaitos.fi">Rahkonen Jukka (MML)</a>;
<a rel="nofollow" shape="rect" target="_blank" href="mailto:gdal-dev@lists.osgeo.org">
gdal-dev@lists.osgeo.org</a></span><br clear="none">
<span style="font-family:Calibri,sans-serif; font-size:11pt; font-weight:bold">Aihe:
</span><span id="yui_3_16_0_ym19_1_1478907638248_7399" style="font-family:Calibri,sans-serif; font-size:11pt">Re: [gdal-dev] How to replace an osm key?</span><br clear="none">
<br clear="none">
</div>
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16082">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478886502261_16081" style="color:#000; background-color:#fff; font-family:verdana,helvetica,sans-serif; font-size:13px">
Thank you Jukka.<br clear="none">
<br clear="none">
I understand now why I need to repeat the same syntax 4 times (by only changing multipolygon/multilinestrings/lines/points).<br clear="none">
<div id="yiv0347963161yui_3_16_0_ym19_1_1478883721769_10460"><br clear="none">
</div>
<div id="yiv0347963161yui_3_16_0_ym19_1_1478883721769_10458"><br clear="none">
</div>
<div id="yiv0347963161yui_3_16_0_ym19_1_1478883721769_10459"><br clear="none">
</div>
Can you explain this part as well please:<br clear="none">
<blockquote id="yiv0347963161yui_3_16_0_ym19_1_1478883721769_10455">
<div dir="ltr" id="yiv0347963161yui_3_16_0_ym19_1_1478883721769_10456"><font id="yiv0347963161yui_3_16_0_ym19_1_1478883721769_10457" color="#808080">> 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 …”</font></div>
</blockquote>
?<br clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>