Select to view content in your preferred language

Question re CssParameter in Styled Layer Descriptor (SLD)

2799
1
11-10-2010 02:15 PM
Labels (1)
RicoLelina
Emerging Contributor
My polygons have a property named fillColor with text values such as #FF0000, #00FF00, etc. In the PolygonSymbolizer, I specify that value of that property to be used as the fill color, so the intent is to have each polygon filled with the color that's in its fillColor property. This should be possible according to p.35 of the OGC Styled Layer Descriptor spec v1.0.0 dated 2002-09-19.

However, ArcGIS 10 does not seem to handle that. When I replace <ogc:Literal><ogc:PropertyName>fillColor</ogc:PropertyName></ogc:Literal> with #ff0000, then each polygon is filled with RED. But with the symbolizer below, each polygon is filled with the default which seems to be #000000. Am I doing something wrong here or is there really no support for this standard in ArcGIS.

Thanks.

<sld:PolygonSymbolizer>
  <sld:Fill>
    <sld:CssParameter name="fill">
      <ogc:Literal><ogc:PropertyName>fillColor</ogc:PropertyName></ogc:Literal>
    </sld:CssParameter>
    <sld:CssParameter name="fill-opacity">1</sld:CssParameter>
  </sld:Fill>
  <sld:Stroke>
    <sld:CssParameter name="stroke">#0000ff</sld:CssParameter>
    <sld:CssParameter name="stroke-width">2</sld:CssParameter>
    <sld:CssParameter name="stroke-opacity">1</sld:CssParameter>
  </sld:Stroke>
</sld:PolygonSymbolizer>
0 Kudos
1 Reply
RicoLelina
Emerging Contributor
Tried this with open source GeoServer and it works with a minor change (see below). It would be a shame if I have to resort to an open source software to style map data stored in my expensive ArcGIS server.

Replace
<sld:CssParameter name="fill">
      <ogc:Literal><ogc:PropertyName>fillColor</ogc:PropertyName></ogc:Literal>
    </sld:CssParameter>

with (take out ogc:Literal tag)
<sld:CssParameter name="fill">
      <ogc:PropertyName>fillColor</ogc:PropertyName>
    </sld:CssParameter>


See bottom of http://geoserver.org/display/GEOSDOC/SLD+Snippets

Database-driven Styling (here we assume PostGIS or other SQL-like system as data backend) -- what if you actually hate XML and SLD but want to style your maps in very data-driven ways.  For example, coloring the area of a given census tract by its average income, or sizing the dot for a city by its population.  One possible approach is to break the wall between data and presentation, storing the correct color and/or other parameters in columns in your database, and pass those values through into the SLD using the  <ogc:PropertyName> tag.
0 Kudos