Hi Justin,
Here's all the info I can think of that might be useful. Let me know
if you need something else.
- The layer I'm displaying is called: "topp:suit_area_h_crop6_diss"
(yeah, I was lazy and haven't created a new namespace to replace the
topp one).
- The layer contains an attribute field named, "class" which has
values that look like this:
class_0
class_1
class_2
class_3
class_4
class_5
class_6
class_7
- The SLD file is located at:
http://localhost:8080/geoserver/www/styles/generic_crop_class.sld
(verified http access)
- I simplified the SLD and removed some of the <Rules> for this
message, so it looks like this now:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
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>generic_crop_class</Name>
<UserStyle>
<Name>generic_crop_class</Name>
<Title>geoserver style</Title>
<Abstract>Generated by GeoServer</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>Class 0</Name>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>class</ogc:PropertyName>
<ogc:Literal>class_0</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#fef7c0</CssParameter>
<CssParameter name="fill-opacity">1</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#fef7c0</CssParameter>
<CssParameter name="stroke-opacity">1</CssParameter>
<CssParameter name="stroke-width"></CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
- I'm attempting to use it in the WMS request with the following URL:
http://localhost:8080/geoserver/wms?bbox=-20.9006165504456,-37.336982917785676,53.899058246612604,19.587803077697775&styles=&Format=application/openlayers&request=GetMap&layers=topp:suit_area_h_crop6_diss&width=800&height=571&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/www/styles/generic_crop_class.sld
- I also created a featuretype style in Geoserver for another,
similar, crop layer, and copied and pasted the SLD shown here into the
editor (only took the section between
<FeatureTypeStyle></FeatureTypeStyle> tags). This was to see if the
Rule worked properly, which it does.
Thanks for taking a look at this,
Roger
--
On Sat, Mar 1, 2008 at 7:25 AM, Justin Deoliveira
<jdeolive@anonymised.com> wrote:
Hi Roger,
Can you include the SLD you are using by any chance? GeoServer can have
some funny behavior sometimes depending on NamedLayer elements in a
style matching the LAYERS parameter of the request. Having both would help.
Thanks,
-Justin
Roger Andre wrote:
> I'm having some trouble getting this to work. I have a couple hundred
> layers which show different things, but which are all styled based on
> a "class" attribute. I would like to store a single SLD under the
> Geoserver www/styles dir, and call upon it via URL when any of the
> layers are displayed. To that end, I styled one of the layers the way
> I wanted it to look, and then copied the SLD for it out of the
> data_dir/styles dir, and into the www one. I then tried to test it by
> adding, "&SLD=http://localhost:8080/geoserver/www/styles/class.sld" to
> the end of a regular WMS request for another layer. It didn't do
> anything, so I tested to make sure that the SLD URL worked properly -
> it does. Are there some things that I should do differently to
> implement this sort of remote-styling?
>
> Thanks,
>
> Roger
--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com
--
Roger André
GIS Developer/Analyst
Enterprise Management Solutions
CH2M HILL
Tel: 425.233.3042