1

I try to create dynamic symbolizers with WKT. This link says a CQL expression can be used inside a WellKnownName or a link:href. I want my symbolizers to have a dynamic size depending on my data on postgis.

Here's my SLD :

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NamedLayer>
    <Name>Real Size</Name>
    <UserStyle>
      <Title>Real Size</Title>
      <Abstract>Real Size</Abstract>
  <FeatureTypeStyle>
    <Rule>
      <Name>container</Name>
   <ogc:Filter>
     <ogc:PropertyIsEqualTo>
       <ogc:PropertyName>ct</ogc:PropertyName>
       <ogc:Literal>container</ogc:Literal>
     </ogc:PropertyIsEqualTo>
   </ogc:Filter>
<PointSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
 <Graphic>
    <Mark>
      <WellKnownName>wkt://POLYGON((0 0,${length}/1.5 0,${length} -${width}/2,${length}/1.5 -${width},0 -${width},0 0))</WellKnownName>
      <Fill>
        <CssParameter name="fill">#0000ff</CssParameter>
      </Fill>
      <Stroke>
        <CssParameter name="stroke">#0000ff</CssParameter>
        <CssParameter name="stroke-width">100</CssParameter>
      </Stroke>
    </Mark>
    <Size>600</Size>
  </Graphic>

The error I've got is :

Rendering process failed The specified mark "wkt://POLYGON((0 0,${length}/1.5 0,${length} -${width}/2,${length}/1.5 -${width},0 -${width},0 0))" was not found!

What am I doing wrong? Is there another way to pass dynamic attributes into my graphics? (like SVG?)

1

Try with:

<WellKnownName>wkt://POLYGON((0 0,${length/1.5} 0,${(length -width)/2} ${length/1.5 - width},0 -${width},0 0))</WellKnownName>

In other words, keep expressions fully parenthesized, only what's inside ${...} will be evaluated, the rest is entered into the well known name string as is.

  • Thanks for the reply, I'll remember that rule ! Anyway I still have the same issue, I've found a workaround drawing my symbols with openlayers in svg but I let that question open, I think this could be a nice feature – So4ne Nov 15 '16 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.