Hi,

“Building” tag can exist in any layer. It is controlled with the osmconf.ini 
file https://svn.osgeo.org/gdal/trunk/gdal/data/osmconf.ini

It is true that by default it is selected only for multipolygons. However, I 
suppose that in the native OSM data the building tag is sometimes used also on 
points and relations (other_relations for GDAL). I also aimed at a general 
answer that could be useful for all tags and layers in OSM data.

-Jukka Rahkonen-

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

Thank you for the reply Jukka.

> and you must run the query separately for all the layers ( points, lines, 
> multilinestrings, multipolygons).
What does this part mean?
That I need to call ogr2ogr.exe four times:
ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI 
Shapefile" -dialect sqlite –sql "select geometry, building as bldg from 
multipolygons” output.shp input.osm

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI 
Shapefile" -dialect sqlite –sql "select geometry, building as bldg from points” 
output.shp input.osm

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI 
Shapefile" -dialect sqlite –sql "select geometry, building as bldg from lines” 
output.shp input.osm

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI 
Shapefile" -dialect sqlite –sql "select geometry, building as bldg from 
multilinestrings” output.shp input.osm
?
Doesn't "building:..." key (field) only exist among the multipolygons?



> 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 …”
I didn't understand you this part either.

The "select geometry, building as bldg, another_attribute as attr_2 …” part 
needs to include only those keys (fields) which I would like to get changed? 
Not all the others which I would like to have them remain the same as in 
original .osm file?

If I misunderstood you, can you please provide an example syntax?

Thank you, and my apology for further disturbance.

Djordje


----------------
On Friday, November 11, 2016 3:14 PM, Rahkonen Jukka (MML) 
<jukka.rahko...@maanmittauslaitos.fi<mailto:jukka.rahko...@maanmittauslaitos.fi>>
 wrote:

Hi,

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.

You can do the whole thing with one command like this:

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI 
Shapefile"
-dialect sqlite –sql "select geometry, building as bldg from multipolygons” 
output.shp input.osm

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).

-Jukka Rahkonen-

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

Reply via email to