Open ebocher opened 4 years ago
Bellow an example of json encoding with a SQL like expression
{
"Feature2DStyle": {
"Name": "Unnamed Style",
"Rule": {
"Name": "Area color expression",
"AreaSymbolizer": {
"Name": "Color area expression",
"Level": 0,
"PenStroke": {
"SolidFill": {
"Color": "#000000",
"Opacity": 1
},
"Width": 0.25,
},
"SolidFill": {
"Color": "expression(CASE WHEN ST_AREA(the_geom)> 50000 then 'red' else 'blue' end)"
}
}
}
}
}
And in xml
<Feature2DStyle>
<Name>Unnamed Style</Name>
<Rule>
<Name>Area color expression</Name>
<AreaSymbolizer>
<Name>Color according a type</Name>
<Uom>PX</Uom>
<Level>0</Level>
<PenStroke>
<SolidFill>
<Color>#000000</Color>
<Opacity>1.0</Opacity>
</SolidFill>
<Width>0.25</Width>
</PenStroke>
<SolidFill>
<Color>expression(CASE WHEN ST_AREA(the_geom)> 50000 then 'red' else 'blue' end)</Color>
</SolidFill>
</AreaSymbolizer>
</Rule>
</Feature2DStyle>