[gdal-dev] Multiple pens in OGR feature style

Andreas Neumann a.neumann at carto.net
Mon Dec 10 10:31:20 PST 2012


Hi Marco and others,

If the (DXF) writer does not support multiple strokes - can you perhaps
export the same feature multiple times using the corresponding OGR
features styles? Ideally, this would honour the symbol levels, if
defined, in QGIS to get the same symbology.

Do you think this is possible?

Thanks,
Andreas



Am 10.12.2012 17:19, schrieb Marco Hugentobler:
> 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
> 
> 



More information about the gdal-dev mailing list