<html><head></head><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1478944862997_5117" dir="ltr"><span id="yui_3_16_0_ym19_1_1478944862997_7016">Thank you for the reply Jukka.<br><br>Neither "building:levels" nor "height" fields were located in </span>osmconf.ini under the "[multipolygons]".<br>I have just added them as you suggested, and now the previously mentioned command creates the .shp file without raising an error.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7424">I tried the initial:<br></div><blockquote id="yui_3_16_0_ym19_1_1478944862997_7289"><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7225">-dialect sqlite -sql "select geometry, building as bldg, <b>'building:levels'</b> as bldg_level, height as height from multipolygons" "C:\ladybug\osm_files\barcelona_shp_files" <br></div></blockquote><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7216">and</div><blockquote id="yui_3_16_0_ym19_1_1478944862997_7311"><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7291">-dialect sqlite -sql "select geometry, building as bldg, <b id="yui_3_16_0_ym19_1_1478944862997_7384">\"building:levels\"</b> as bldg_level, height as height from multipolygons" "C:\ladybug\osm_files\barcelona_shp_files" <br></div></blockquote><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7181">And they both work.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7441"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_7442">The problem is that: once the .shp file is created, and I open it, all shapes have the "building:level" value for the "bldg_level" field. Here is a screenshot:<br><a href="https://www.dropbox.com/s/nmlkkzr85w225qb/sql_choosing_keys.jpg?dl=0" id="yui_3_16_0_ym19_1_1478944862997_9365" class="">https://www.dropbox.com/s/nmlkkzr85w225qb/sql_choosing_keys.jpg?dl=0</a><br><br>Why is this happening?<br><br>Kind Regards,<br>Djordje<br></div><div id="yui_3_16_0_ym19_1_1478944862997_9448"><br></div>-----------------------<br><div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1478944862997_5030" style="display: block;"> <div style="font-family: verdana, helvetica, sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1478944862997_5029"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1478944862997_5028"> <div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_5032"><font id="yui_3_16_0_ym19_1_1478944862997_5031" size="2" face="Arial"> On Saturday, November 12, 2016 10:29 AM, Rahkonen Jukka (MML) <jukka.rahkonen@maanmittauslaitos.fi> wrote:<br></font></div>  <br><br> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1478944862997_5036"><div id="yiv5516807248"><div id="yui_3_16_0_ym19_1_1478944862997_5035">
<div id="yui_3_16_0_ym19_1_1478944862997_5034">
<div style="font-family:Calibri, sans-serif;font-size:11pt;" id="yui_3_16_0_ym19_1_1478944862997_5033">Hi,<br clear="none">
<br clear="none">
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 clear="none">
<br clear="none">
-Jukka-<br clear="none">
</div>
</div>
<div class="yiv5516807248yqt0073946270" id="yiv5516807248yqt26386"><div dir="ltr" id="yui_3_16_0_ym19_1_1478944862997_5037">
<hr id="yui_3_16_0_ym19_1_1478944862997_7089">
<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" ymailto="mailto:issworld2000@yahoo.com" 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;">‎12.‎11.‎2016 3:37</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" ymailto="mailto:jukka.rahkonen@maanmittauslaitos.fi" target="_blank" href="mailto:jukka.rahkonen@maanmittauslaitos.fi">Rahkonen Jukka (MML)</a>;
<a rel="nofollow" shape="rect" ymailto="mailto:gdal-dev@lists.osgeo.org" 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 style="font-family:Calibri, sans-serif;font-size:11pt;" id="yui_3_16_0_ym19_1_1478944862997_7090">Re: VS: [gdal-dev] How to replace an osm key?</span><br clear="none">
<br clear="none">
</div>
<div id="yui_3_16_0_ym19_1_1478944862997_5053">
<div style="color:#000;background-color:#fff;font-family:verdana, helvetica, sans-serif;font-size:13px;" id="yui_3_16_0_ym19_1_1478944862997_5052">
<div><span></span></div>
<div id="yiv5516807248yui_3_16_0_ym19_1_1478886502261_12701" style="color:#000;background-color:#fff;font-family:verdana, helvetica, sans-serif;font-size:13px;">
<div id="yiv5516807248yui_3_16_0_ym19_1_1478886502261_6951"><span></span></div>
<div class="yiv5516807248qtdSeparateBR" id="yiv5516807248yui_3_16_0_ym19_1_1478886502261_12791">
Hi Jukka,<br clear="none">
<br clear="none">
<div dir="ltr" id="yiv5516807248yui_3_16_0_ym19_1_1478907638248_7336">I have just tried to rename the fields with SQL. Here is the syntax:</div>
<blockquote id="yiv5516807248yui_3_16_0_ym19_1_1478907638248_9241">
<div dir="ltr" id="yiv5516807248yui_3_16_0_ym19_1_1478907638248_7338">"C:\gdal\ogr2ogr.exe" --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile"
<b id="yiv5516807248yui_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="yiv5516807248yui_3_16_0_ym19_1_1478907638248_9230">It raises the following error message:</div>
<blockquote id="yiv5516807248yui_3_16_0_ym19_1_1478907638248_11287">
<div dir="ltr" id="yiv5516807248yui_3_16_0_ym19_1_1478907638248_11219"><font id="yiv5516807248yui_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="yiv5516807248yui_3_16_0_ym19_1_1478907638248_11272" clear="none">
no such column: height</font><br clear="none">
</div>
</blockquote>
<div dir="ltr" id="yiv5516807248yui_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 clear="none">
<br clear="none">
So why is the upper <i id="yiv5516807248yui_3_16_0_ym19_1_1478907638248_13178">"no such column: height"</i> error message raised?<br clear="none">
<br clear="none">
Is something wrong with the SQL syntax?<br clear="none">
<br clear="none">
Thank you for the reply.<br clear="none">
<br clear="none">
Kind regards,<br clear="none">
Djordje

</div>
</div>
</div></div></div></div></div></div></div>  </div> </div>  </div></div></body></html>