[gdal-dev] OGR style fields

Frank Warmerdam warmerdam at pobox.com
Sat Jan 19 14:26:42 EST 2008


Tamas Szekeres wrote:
> 2008/1/19, Stefan Keller <sfkeller at gmail.com>:
>> About two weeks ago I proposed in the FWTools list to enable users of
>> OGR/GDAL tools like ogr2ogr to set the style parameters from the command
>> line or using .VRT. This would be a valuable extension for writing KML
>> files.
>>
> 
> Stefan,
> 
> How do you think this kind of configuration should look like. How
> should we change the style per feature at the ogr2ogr command line?
> Would it be sufficient for example to set this style for each feature
> equally by using a field alias or something like:
> 
> ogr2ogr -f KML -sql "select *, [stylestring] as OGR_STYLE from
> mylayer" mylayer.kml mylayer.shp

Tamas,

I'd note that the OGR SQL parser does not understand how to use
"AS" to rename a field.

> I'm also uncertain about the usability of producing a full fledged
> ready to use KML output by the driver this way and setting up the
> style representation in a specific way inside. This driver should
> instead become template based or something that more customizable.

I don't think templating or related logic needs to be part of OGR.
If someone wanted dynamic styling for a set of features, then they
would presumably have to write a program or script that produced the
appropriate style string for each feature based on the feature
characteristics.

With the change (GetStyle() falls back to OGR_STYLE attribute) I think
the only other OGR changes that might be needed are:

  * Support for style strings in the KML driver (missing now completely
    as far as I know *and* I'm not even sure that KML styling options
    would be well represented by OGR Feature Style strings).

  * Some mechanism to manage feature styles - at least carrying them
    through or reassigning to an attribute - in the VRT driver.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list