The following style works fine:
define: &textstyle
label: ${fsmap_metadata_bean_rm}
fill-color: '#AAAAAA'
font-family: Lucida Sans Demibold
font-size: 20.0
font-style: normal
font-weight: normal
placement: point
define: &polystyle
stroke-color: '#FFFFFF'
stroke-opacity: '1.0'
stroke-width: 0.4
stroke-linejoin: bevel
name: test_na_us_bean_rm_zones_YSLD_working
title: Relative Maturity style
feature-styles:
- name: name
rules:
- filter: ${fsmap_metadata_bean_rm = 'Zone 00'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#92C5DE'
- filter: ${fsmap_metadata_bean_rm = 'Zone 0'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#D1E5F0'
- filter: ${fsmap_metadata_bean_rm = 'Zone 1'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#FFF7EC'
- filter: ${fsmap_metadata_bean_rm = 'Zone 2'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#FEE8C8'
- filter: ${fsmap_metadata_bean_rm = 'Zone 3'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#FDBB84'
- filter: ${fsmap_metadata_bean_rm = 'Zone 4'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#FC8D59'
- filter: ${fsmap_metadata_bean_rm = 'Zone 5'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#EF6548'
- filter: ${fsmap_metadata_bean_rm = 'Zone 6'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#EF6548'
- filter: ${fsmap_metadata_bean_rm = 'Zone 7'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#D7301F'
- filter: ${fsmap_metadata_bean_rm = 'Zone 8'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#B30000'
- filter: ${fsmap_metadata_bean_rm = 'Zone 9'}
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: '#7F0000'
However, when translated to use recode, it does not display:
define: &textstyle
label: ${fsmap_metadata_bean_rm}
fill-color: '#AAAAAA'
font-family: Lucida Sans Demibold
font-size: 20.0
font-style: normal
font-weight: normal
placement: point
define: &polystyle
stroke-color: '#FFFFFF'
stroke-opacity: '1.0'
stroke-width: 0.4
stroke-linejoin: bevel
name: test_na_us_bean_rm_zones_YSLD_not_working
title: Relative Maturity style
feature-styles:
- name: name
rules:
- name: fsmap_metadata_bean_rm
scale: [0, 147914382]
symbolizers:
- text:
<<: *textstyle
- polygon:
<<: *polystyle
fill-color: ${recode(fsmap_metadata_bean_rm,'Zone 00', '#92C5DE','Zone 0', '#D1E5F0','Zone 1', '#FFF7EC','Zone 2', '#FEE8C8','Zone 3', '#FDD49E','Zone 4', '#FDBB84','Zone 5', '#FC8D59','Zone 6', '#EF6548','Zone 7', '#D7301F','Zone 8', '#B30000','Zone 9', '#7F0000')}
The equivalent SLD also doesn’t work, so this issue is not limited to YSLD:
<?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
<sld:NamedLayer>
<sld:Name>test_na_us_bean_rm_zones_YSLD_singleline</sld:Name>
<sld:UserStyle>
<sld:Name>test_na_us_bean_rm_zones_YSLD_singleline</sld:Name>
<sld:Title>Relative Maturity style</sld:Title>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>fsmap_metadata_bean_rm</sld:Name>
<sld:MaxScaleDenominator>1.47914382E8</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>fsmap_metadata_bean_rm</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name="font-family">Lucida Sans Demibold</sld:CssParameter>
<sld:CssParameter name="font-size">20.0</sld:CssParameter>
<sld:CssParameter name="font-style">normal</sld:CssParameter>
<sld:CssParameter name="font-weight">normal</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0</sld:AnchorPointX>
<sld:AnchorPointY>0.5</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill>
<sld:CssParameter name="fill">#AAAAAA</sld:CssParameter>
</sld:Fill>
</sld:TextSymbolizer>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">
<ogc:Function name="Recode">
<ogc:PropertyName>fsmap_metadata_bean_rm</ogc:PropertyName>
<ogc:Literal>Zone 00</ogc:Literal>
<ogc:Literal>#92C5DE</ogc:Literal>
<ogc:Literal>Zone 0</ogc:Literal>
<ogc:Literal>#D1E5F0</ogc:Literal>
<ogc:Literal>Zone 1</ogc:Literal>
<ogc:Literal>#FFF7EC</ogc:Literal>
<ogc:Literal>Zone 2</ogc:Literal>
<ogc:Literal>#FEE8C8</ogc:Literal>
<ogc:Literal>Zone 3</ogc:Literal>
<ogc:Literal>#FDD49E</ogc:Literal>
<ogc:Literal>Zone 4</ogc:Literal>
<ogc:Literal>#FDBB84</ogc:Literal>
<ogc:Literal>Zone 5</ogc:Literal>
<ogc:Literal>#FC8D59</ogc:Literal>
<ogc:Literal>Zone 6</ogc:Literal>
<ogc:Literal>#EF6548</ogc:Literal>
<ogc:Literal>Zone 7</ogc:Literal>
<ogc:Literal>#D7301F</ogc:Literal>
<ogc:Literal>Zone 8</ogc:Literal>
<ogc:Literal>#B30000</ogc:Literal>
<ogc:Literal>Zone 9</ogc:Literal>
<ogc:Literal>#7F0000</ogc:Literal>
</ogc:Function>
</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name="stroke">#FFFFFF</sld:CssParameter>
<sld:CssParameter name="stroke-linejoin">bevel</sld:CssParameter>
<sld:CssParameter name="stroke-width">0.4</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
|