[OpenLayers-Users] SLD PointSymbolizer - size defined with variable

Martin.L hermsdorfer84 at web.de
Fri Jun 4 10:00:32 EDT 2010


Keywords: GeoServer 2.0.2, OpenLayers, SLD

Hey there!

Is it possible to define the size of a PointSymbolizer with a variable? So
far the SLD-Code looks like this:


[...]
<Rule>
   <Title>Magnitude &lt; 3</Title>
       <ogc:Filter>
	  <ogc:PropertyIsLessThan>
		<ogc:PropertyName>magnitude</ogc:PropertyName>
		<ogc:Literal>3</ogc:Literal>
          </ogc:PropertyIsLessThan>
       </ogc:Filter>
       <PointSymbolizer>
	  <Graphic>
             <Mark>
                <WellKnownName>circle</WellKnownName>
	           <Fill>
			<CssParameter name="fill-opacity">0.4</CssParameter>
			<CssParameter name="fill">#FF0000</CssParameter>
		   </Fill>
             </Mark>
             <Size>4</Size>
          </Graphic>
       </PointSymbolizer>
</Rule>
[...]


Now I want to replace the constant size 4 with a variable which contains a
double value (magnitude). How can I realize it?

I found an idea with GeoServer 2.0.2. Perhaps you find a further solution
for it. With GeoServer 2.0.2 you can use Parameter substitution in SLD (
http://docs.geoserver.org/stable/en/user/styling/sld-extensions/substitution.html
Parameter Substitution ). So I made a new SLD looks like this:


[...]
<PointSymbolizer>
   <Graphic>
        <Mark>
            <WellKnownName>circle</WellKnownName>
		<Fill>
		     <CssParameter name="fill">
			#<ogc:Function name="env">
			     <ogc:Literal>color</ogc:Literal>
			     <ogc:Literal>FF0000</ogc:Literal>
		          </ogc:Function>
		     </CssParameter>
		</Fill>
        </Mark>
        <Size>
	     <ogc:Function name="env">
		  <ogc:Literal>size</ogc:Literal>
		  <ogc:Literal>6</ogc:Literal>
	     </ogc:Function>
        </Size>
    </Graphic>
</PointSymbolizer>
[...]


With this SLD you can manipulate the WMS-request with a env-Parameter in a
adressbar or in OpenLayers WMS-request looking like this:


earthquakes = new OpenLayers.Layer.WMS(
        "Earthquakes",
        "/geoserver/wms?",
        {
		layers: "cite:EarthquakeView",
		env: "size:16", //<<------
		transparent: "true"
        }, 
	{
        	buffer: 0,
        	visibility: true,
        	isBaseLayer: false,
		displayInLayerSwitcher: true
        }
);


Is it possible to get a value from WMS-request from GeoServer or from my db
where the data is stored? If it is, I could add this value to the
env-parameter.

A great thank you in advance.
Martin
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/SLD-PointSymbolizer-size-defined-with-variable-tp5139542p5139542.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list