[gdal-dev] Regarding missing stylestring in SQLITE Driver

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Wed May 22 07:11:30 PDT 2013


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'"

Step 2: Check with ogrinfo what we have in the db

C:\ohjelmat\GDAL_dev>ogrinfo -al styletest.sqlite
INFO: Open of `styletest.sqlite'
      using driver `SQLite' successful.

........

FID Column = OGC_FID
Geometry Column = GEOMETRY
highway: String (0.0)
ref: String (0.0)
ogr_style: String (0.0)
OGRFeature(points):1
  highway (String) = bus_stop
  ref (String) = (null)
  ogr_style (String) = SYMBOL(id:bus_stop.png)
  Style = SYMBOL(id:bus_stop.png)
  POINT (28.0978864 61.0612954)

OGRFeature(points):2
  highway (String) = bus_stop
  ref (String) = (null)
  ogr_style (String) = SYMBOL(id:bus_stop.png)
  Style = SYMBOL(id:bus_stop.png)
  POINT (28.1802628 61.0576507)

Looks good to me.

-Jukka Rahkonen-





More information about the gdal-dev mailing list