[gdal-dev] Multiple pens in OGR feature style

Marco Hugentobler marco at sourcepole.ch
Mon Dec 10 08:19:44 PST 2012


Hi Even



Ok, so it seems to depend on the format properties.

Hi Even

You are right, it seems to depend on the output driver/format. Actually 
my main interest is the dxf format, it seems that one takes the first 
element of the style. Don't know if there are drivers which handle 
multiple pens / brushes. So probably I'll write everything into the 
style string and let the driver do what's best for the concrete format.

Thanks,
Marco

On 10.12.2012 15:29, Even Rouault wrote:
> 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


-- 
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee



More information about the gdal-dev mailing list