Fill color expression for feature rendering

classic Classic list List threaded Threaded
2 messages Options
Daven Quinn Daven Quinn
Reply | Threaded
Open this post in threaded view
|

Fill color expression for feature rendering

Hi,

I am trying to color a bunch of features from a PostGIS database. The feature table contains a column with a distinct HTML color string (e.g. #faa050) for each feature. When using an expression to set the color string, all features show up the same color. Is this expected behavior? It would be ideal if the fill attribute supported expressions.

I'm using osgEarth master for what it's worth. The relevant excerpt from my Earth file is below.

Best,
Daven

<image name="features" driver="agglite">
    <features driver="ogr">
        <connection>PG:dbname=syrtis</connection>
        <layer>mapping.map_face</layer>
    </features>
    <styles>
        <style type="text/css"> style1 { stroke: #000000; stroke-width: 2.0; fill: [color]; altitude-clamping: terrain; altitude-technique: drape; } </style>    </styles>
  </image>
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Fill color expression for feature rendering

Daven,

Unfortunately, osgEarth does not parse the fill color as an expression. So you cannot resolve it at run time.

The only way to achieve something like this today is to use the technique is the "feature_scripted_styling.earth" example, and create the entire style CSS string in JavaScript.
Glenn Waldron / Pelican Mapping