[Geoserver-users] Wms sld question

All,

I'm trying to write a wms 'SLD_BODY' request where I get a base layer
('world')
and a filtered layer ('all_species') on top.

This works for just the base layer:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000&r
equest=GetMap&
width=660&height=720&format=image/png&srs=EPSG:105000&SLD_BODY=
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>cei:world</Name>
    <NamedStyle>
      <Name>other_polygons</Name>
    </NamedStyle>
  </NamedLayer>
</StyledLayerDescriptor>

And this works for the filtered layer:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000&r
equest=GetMap&
layers=cei:all_species&width=660&height=720&styles=ns_ranges&format=image/pn
g&srs=EPSG:105000&filter=
<Filter>
  <PropertyIsEqualTo>
    <PropertyName>sci_name</PropertyName>
    <Literal>Sterna paradisaea</Literal>
  </PropertyIsEqualTo>
</Filter>

So I thought something like this would work to get both layers on the same
map,
but it doesn't, it just hangs:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000&r
equest=GetMap&
width=660&height=720&format=image/png&srs=EPSG:105000&SLD_BODY=
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>cei:world</Name>
    <NamedStyle>
      <Name>other_polygons</Name>
    </NamedStyle>
  </NamedLayer>
  <NamedLayer>
    <Name>cei:all_species</Name>
    <Rule>
      <Filter>
        <PropertyIsEqualTo>
  
<PropertyName>sci_name</PropertyName>
          <Literal>Sterna paradisaea</Literal>
        </PropertyIsEqualTo>
      </Filter>
    </Rule>
    <NamedStyle>
      <Name>ns_ranges</Name>
    </NamedStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Any thoughts?

Thanks,
Steve

Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University
814.865.9905
src176@anonymised.com

Stephen Crawford ha scritto:

All,

I'm trying to write a wms 'SLD_BODY' request where I get a base layer
('world')
and a filtered layer ('all_species') on top.

This works for just the base layer:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000&r
equest=GetMap&
width=660&height=720&format=image/png&srs=EPSG:105000&SLD_BODY=
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>cei:world</Name>
    <NamedStyle>
      <Name>other_polygons</Name>
    </NamedStyle>
  </NamedLayer>
</StyledLayerDescriptor>

And this works for the filtered layer:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000&r
equest=GetMap&
layers=cei:all_species&width=660&height=720&styles=ns_ranges&format=image/pn
g&srs=EPSG:105000&filter=
<Filter>
  <PropertyIsEqualTo>
    <PropertyName>sci_name</PropertyName>
    <Literal>Sterna paradisaea</Literal>
  </PropertyIsEqualTo>
</Filter>

So I thought something like this would work to get both layers on the same
map,
but it doesn't, it just hangs:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000&r
equest=GetMap&
width=660&height=720&format=image/png&srs=EPSG:105000&SLD_BODY=
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>cei:world</Name>
    <NamedStyle>
      <Name>other_polygons</Name>
    </NamedStyle>
  </NamedLayer>
  <NamedLayer>
    <Name>cei:all_species</Name>
    <Rule>
      <Filter>
        <PropertyIsEqualTo>
  
<PropertyName>sci_name</PropertyName>
          <Literal>Sterna paradisaea</Literal>
        </PropertyIsEqualTo>
      </Filter>
    </Rule>
    <NamedStyle>
      <Name>ns_ranges</Name>
    </NamedStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Any thoughts?

Well, the second request xml does not comply with the SLD xml schema,
which you can find here:
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd

There is in fact a compliant sld way to make what you want, but
I'm not sure we do support it (it would require the usage of
FeatureTypeConstraint element, whose support we have only in 1.6.0
and only related to remote layers).

Anyways, a working way to do what you want is to
make a standard wms request with two filters:
http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000
&request=GetMap&layers=cei:world,cei:all_species&width=660&height=720
&styles=other_polygons,ns_ranges&format=image/png&srs=EPSG:105000
&filter=(filter1)(filter2)

where filter1 in your case would be empty, in this case make sure you
just put a space between the parenthesis.

Hope this helps
Cheers
Andrea

Andrea,

That works great. Thanks a lot.

Steve

-----Original Message-----
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Andrea
Aime
Sent: Wednesday, December 05, 2007 12:49 PM
To: Stephen Crawford
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Wms sld question

Stephen Crawford ha scritto:

All,

I'm trying to write a wms 'SLD_BODY' request where I get a base layer
('world')
and a filtered layer ('all_species') on top.

This works for just the base layer:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,810
0000&r
equest=GetMap&
width=660&height=720&format=image/png&srs=EPSG:105000&SLD_BODY=
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>cei:world</Name>
    <NamedStyle>
      <Name>other_polygons</Name>
    </NamedStyle>
  </NamedLayer>
</StyledLayerDescriptor>

And this works for the filtered layer:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,810
0000&r
equest=GetMap&
layers=cei:all_species&width=660&height=720&styles=ns_ranges&format=im
age/pn
g&srs=EPSG:105000&filter=
<Filter>
  <PropertyIsEqualTo>
    <PropertyName>sci_name</PropertyName>
    <Literal>Sterna paradisaea</Literal>
  </PropertyIsEqualTo>
</Filter>

So I thought something like this would work to get both layers on the
same map, but it doesn't, it just hangs:

http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,810
0000&r
equest=GetMap&
width=660&height=720&format=image/png&srs=EPSG:105000&SLD_BODY=
<StyledLayerDescriptor>
  <NamedLayer>
    <Name>cei:world</Name>
    <NamedStyle>
      <Name>other_polygons</Name>
    </NamedStyle>
  </NamedLayer>
  <NamedLayer>
    <Name>cei:all_species</Name>
    <Rule>
      <Filter>
        <PropertyIsEqualTo>
  
<PropertyName>sci_name</PropertyName>
          <Literal>Sterna paradisaea</Literal>
        </PropertyIsEqualTo>
      </Filter>
    </Rule>
    <NamedStyle>
      <Name>ns_ranges</Name>
    </NamedStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Any thoughts?

Well, the second request xml does not comply with the SLD xml schema, which
you can find here:
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd

There is in fact a compliant sld way to make what you want, but I'm not sure
we do support it (it would require the usage of FeatureTypeConstraint
element, whose support we have only in 1.6.0 and only related to remote
layers).

Anyways, a working way to do what you want is to make a standard wms request
with two filters:
http://localhost:8080/geoserver/wms?bbox=-6600000,-6300000,6600000,8100000
&request=GetMap&layers=cei:world,cei:all_species&width=660&height=720
&styles=other_polygons,ns_ranges&format=image/png&srs=EPSG:105000
&filter=(filter1)(filter2)

where filter1 in your case would be empty, in this case make sure you just
put a space between the parenthesis.

Hope this helps
Cheers
Andrea

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from
Novell. From the desktop to the data center, Linux is going mainstream.
Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Stephen Crawford ha scritto:

Andrea,

That works great. Thanks a lot.

Ah, one thing. In my main I said "a standard wms request".
In fact that's not standard at all. The ability to
specify a filter in a WMS request is a GeoServer specific
extension to the wms standard, but it's not portable
from one server to the other.
We mimicked what WFS does, and it seems to make a lot of
sense and be useful, but beware, if you use it you're
stuck on geoserver.

Cheers
Andrea