Hi,

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.

-Jukka-
________________________________
Lähettäjä: Djordje Spasic<mailto:issworld2...@yahoo.com>
Lähetetty: ‎12.‎11.‎2016 3:37
Vastaanottaja: Rahkonen Jukka 
(MML)<mailto:jukka.rahko...@maanmittauslaitos.fi>; 
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
Aihe: Re: VS: [gdal-dev] How to replace an osm key?

Hi Jukka,

I have just tried to rename the fields with SQL. Here is the syntax:
"C:\gdal\ogr2ogr.exe" --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f 
"ESRI Shapefile" -dialect sqlite -sql "select geometry, building as bldg, 
'building:levels' as bldg_level, height as height from multipolygons" 
output_shps input.osm
It raises the following error message:
ERROR 1: In ExecutableSQL<>: sqlite3_prepare<select geometry, building as bldg, 
'building:levels' as bldg_level, height as height from multipolygons>:
no such column: height
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.

So why is the upper "no such column: height" error message raised?

Is something wrong with the SQL syntax?

Thank you for the reply.

Kind regards,
Djordje

----------------------------


On Friday, November 11, 2016 6:46 PM, Rahkonen Jukka (MML) 
<jukka.rahko...@maanmittauslaitos.fi> wrote:


Hi,

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.

-Jukka-
________________________________
Lähettäjä: Djordje Spasic<mailto:issworld2...@yahoo.com>
Lähetetty: ‎11.‎11.‎2016 19:10
Vastaanottaja: Rahkonen Jukka 
(MML)<mailto:jukka.rahko...@maanmittauslaitos.fi>; 
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
Aihe: Re: [gdal-dev] How to replace an osm key?

Thank you Jukka.

I understand now why I need to repeat the same syntax 4 times (by only changing 
multipolygon/multilinestrings/lines/points).



Can you explain this part as well please:
> 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 …”
?


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to