[gdal-dev] change attribute type of OSM data

maning sambale emmanuel.sambale at gmail.com
Mon Jul 18 21:19:54 PDT 2016


Hi Even,

Here's mi osmconf.ini:
https://gist.github.com/anonymous/f9b34c34a2107fd4fb3a5dfa5931b78f

Converting to shapefile:
ogr2ogr -f "ESRI Shapefile" -overwrite labuildings.shp
california-latest.osm.pbf -spat -118.952 32.75 -117.646 34.8233
--config OSM_CONFIG_FILE osmconf.ini -progress -sql 'select * from
multipolygons where building is not null'

I get the following:
ogrinfo -so -al labuildings.shp
<snip>
height: String (80.0)
ele: String (80.0)
start_date: String (80.0)
other_tags: String (254.0)

On Mon, Jul 18, 2016 at 7:37 PM, Even Rouault
<even.rouault at spatialys.com> wrote:
> Le lundi 18 juillet 2016 09:22:52, maning sambale a écrit :
>> Hi,
>>
>> I found this section of the code osmconf.ini:
>>
>> # type of attribute 'foo' can be changed with something like
>> #foo_type=Integer/Real/String/DateTime
>>
>> So in my configuration I have the following:
>>
>> # keys to report as OGR fields
>> attributes=name,building,height,ele,start_date,
>>
>> height_type=Real
>> ele_type=Real
>> start_date_type=DateTime
>>
>> Not sure if I'm doing it correctly
>
> This looks good, but you can check for sure by looking at the attribute types
> returned with ogrinfo -so -al your.osm
>
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com



-- 
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
https://epsg4253.wordpress.com/
http://twitter.com/maningsambale
------------------------------------------------------


More information about the gdal-dev mailing list