[gdal-dev] Hide OGR_STYLE from PDF attributes

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Mon Nov 12 14:14:55 PST 2012


Even Rouault wrote:

> Le lundi 12 novembre 2012 11:51:10, Jukka Rahkonen a écrit :
>> Hi,
>>
>> If I write some vector data from OGR_DATASOURCE into geospatial PDF and I
>> would like to style symbols with OGR_STYLE, then ORG_STYLE string will
>> also be written ínto the model tree of the resulting PDF file as an
>> attribute. I consider that it would be better not to transfer OGR_STYLE at
>> all as an attribute. If somebody really wants to send style definitions
>> into PDF as attributes it could still be done by selecting styles another
>> time with SQL with some other attribute name.
>>
>> My select in the .vrt file is as follows
>> <SrcSQL>SELECT *,ref as ID, 'SYMBOL(id:ogr-sym-3,c:#FF0000,s:10px)' as
>> OGR_STYLE from points where highway='bus_stop'</SrcSQL>
>>

> I'm not sure how to do that without adding a hack into the PDF driver (and
> potentially other drivers).

> But I can offer an easy workaround. You can edit your VRT to explictely mention
> the fields you want to export. For example :

<OGRVRTDataSource>
    <OGRVRTLayer name="point">
        <SrcDataSource relativeToVRT="0" shared="1">point.vrt</SrcDataSource>
        <SrcSQL>SELECT *, 'SYMBOL(id:ogr-sym-3,c:#FF0000,s:10px)' as OGR_STYLE
FROM point</SrcSQL>
        <Field name="id"/>
    </OGRVRTLayer>
</OGRVRTDataSource>

What a trick, I would have never guessed to limit what gets selected by SrcSQL with Field name. It works, it is logical even it feels odd, and one day, if I still remember it, they will call me guru too.

-Jukka-


More information about the gdal-dev mailing list