[gdal-dev] How to replace an osm key?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Fri Nov 11 07:04:22 PST 2016


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:issworld2000 at yahoo.com]
Lähetetty: 11. marraskuuta 2016 16:38
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>; gdal-dev at 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.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at 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-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161111/16873aa0/attachment-0001.html>


More information about the gdal-dev mailing list