[gdal-dev] Multiple pens in OGR feature style

Even Rouault even.rouault at mines-paris.org
Mon Dec 10 06:29:44 PST 2012


Selon Marco Hugentobler <marco at sourcepole.ch>:

>
> Hi
>
> I'm currently implementing support for OGR feature styles in the QGIS
> vector layer export. In QGIS symbology, there is the possibility to
> compose a symbol with multiple symbol layers, e.g. a broad black line
> with a thin white line on top of it for a road symbol. Is this supported
> by the OGR feature styles to have multiple pens / brushes in the same
> symbol string?
> I tried the style string
> 'PEN(c:#008000,w:3mm,l:1);PEN(c:#ff0000,w:2mm,l:2)'. However, in a kml
> export, only the first style seems to be picked up. So I wonder if there
> is something wrong with my style string or if it is not supported by the
> feature style mechanism.

Marco,

I was surprised that multiple pens were allowed, but yes, there doesn't seem to
be any limitation on multiple instanciations of the same style tool in the spec
or the generic code of the OGR FeatureStyle implementation. However I'd be
surprised that many drivers (and formats) can handle that properly.

Looking at addstylestring2kml() in ogr/ogrsf_frmts/libkml/ogrlibkmlstyle.cpp, I
can see that only one PEN instance will be taken into account (looking at the
coulde, I would have said that it would be the last occurence...). And it seems
that it is a limitation of LIBKML itself, since the Style class seems to accept
only one line style.

http://code.google.com/searchframe#y2CS_eJ3ink/trunk/src/kml/dom/style.h&q=style.h%20package:libkml\.googlecode\.com

Best regards,

Even


More information about the gdal-dev mailing list