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

Djordje Spasic issworld2000 at yahoo.com
Fri Nov 11 09:55:34 PST 2016


Thank you Jukka.

Does this:

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile" -dialect sqlite –sql "select geometry, building as bldg, foo, bar from multipolygons” output.shp input.osm
replace the part from the osmconfig.ini file:

# keys to report as OGR fields
attributes=building,foo,bar

?
 
----------------------------
    On Friday, November 11, 2016 6:46 PM, Rahkonen Jukka (MML) <jukka.rahkonen at 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
Lähetetty:‎11.‎11.‎2016 19:10
Vastaanottaja:Rahkonen Jukka (MML);gdal-dev at 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 …”
?


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


   On Friday, November 11, 2016 4:04 PM, Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi> wrote:

Hi, “Building” tag can exist in any layer. It is controlled with the osmconf.ini filehttps://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 frommultipolygons” output.shp input.osm

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

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

ogr2ogr.exe --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile" -dialect sqlite –sql "select geometry, building as bldg frommultilinestrings” 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161111/3af095c0/attachment.html>


More information about the gdal-dev mailing list