[gdal-dev] Regarding missing stylestring in SQLITE Driver

Even Rouault even.rouault at mines-paris.org
Wed May 22 10:54:00 PDT 2013


Le mercredi 22 mai 2013 16:11:30, Jukka Rahkonen a écrit :
> Abhinav <abhinav <at> vizexperts.com> writes:
> > Hi All,
> > 
> > I am using sqlite driver to write the OGRLayer to disk. I am setting
> > StyleString for each feature. But when I read back, my feature contains
> > NULL stylestring.  Though I am able to get other attributes, I am
> > setting to the feature.
> > 
> > I wonder whether sqlite driver supports writing style string or not? If
> > It allows, do we have to give any option to enable writing of the style
> > ?
> 
> Hi,
> 
> Please tell us how you tried to do your task. Here is what I did in my
> quick test.
> 
> 
> Step 1: Set OGR style with SQL and write features with styles into
> Spatialite db.
> 
> ogr2ogr -f SQLite -dsco spatialite=yes styletest.sqlite finland.osm.pbf
> -sql "select highway, ref, 'SYMBOL(id:bus_stop.png)' as OGR_STYLE from
> points where highway='bus_stop'"

Abhinav,

Jukka's suggestion to set a OGR_STYLE attribute is actually what you can do to 
have styles written in a sqlite database. The SetStyleString() API is 
supported directly by very few formats (only MapInfo comes to mind). For other 
cases, using the special OGR_STYLE attribute is the only way to go.

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list