[Geoserver-users] Two UserLayers in SLD?

Hi,

Can I have two <UserLayer> tags in one SLD, as follows? I have tried but it
seems like no map is returned.

http://localhost:8080/geoserver/wms?bbox=103.59736493356376,1.17866724157080
97,104.09707604959173,1.4807073969316509
<http://localhost:8080/geoserver/wms?bbox=103.59736493356376,1.1786672415708
097,104.09707604959173,1.4807073969316509&Format=image/png&request=GetMap&wi
dth=800&height=400&srs=EPSG:4326&SLD_BODY>
&Format=image/png&request=GetMap&width=800&height=400&srs=EPSG:4326&SLD_BODY

<StyledLayerDescriptor version="1.0.0">
            <UserLayer>
                           <Name>prrm:history_track</Name>
                           <UserStyle>
                                          <Title>Default Styler</Title>
                                          <Abstract></Abstract>
                                          <FeatureTypeStyle>

<FeatureTypeName>Feature</FeatureTypeName>
                     </FeatureTypeStyle>
              </UserStyle>
      </UserLayer>
      <UserLayer>
                           <Name>prrm:vehicle_map</Name>
                           <UserStyle>
                                          <Title>Default Styler</Title>
                                          <Abstract></Abstract>
                                          <FeatureTypeStyle>

<FeatureTypeName>Feature</FeatureTypeName>
                     </FeatureTypeStyle>
             </UserStyle>
      </UserLayer>
</StyledLayerDescriptor>

Would appreciate any help. Thank you.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the message
from your system; please do not copy or use it for any purpose, nor disclose
its contents to any other person. Thank you.]
---ST Electronics Group---

Looking at the spec, I think you need to include the LayerFeatureConstraints element:
<LayerFeatureConstraints>
<FeatureTypeConstraint>
<FeatureTypeName>MyFeatureName</FeatureTypeName>
</FeatureTypeConstraint>
</LayerFeatureConstraints>

See section 7.3 of the spec here: http://www.opengeospatial.org/docs/02-070.pdf

Here is the section from the spec:
<xs:elementname="UserLayer">
<xs:complexType>
<xs:sequence>
<xs:elementref="sld:Name"minOccurs="0"/>
<xs:elementref="sld:RemoteOWS"minOccurs="0"/>
<xs:elementref="sld:LayerFeatureConstraints"/>
<xs:elementref="sld:UserStyle"maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Here is their example:

<StyledLayerDescriptorversion="1.0.0">
<UserLayer>
<Name>MyLayer</Name>
<RemoteOWS>
<Service>WFS</Service>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink&quot;
xlink:type="simple"
xlink:href="http://some.site.com/WFS?&quot;/&gt;
</RemoteOWS>
<LayerFeatureConstraints>
<FeatureTypeConstraint>
<FeatureTypeName>RoadFeatures</FeatureTypeName>
</FeatureTypeConstraint>
</LayerFeatureConstraints>
<UserStyle>
[...]
</UserStyle>
</UserLayer>
</StyledLayerDescriptor>

But you should be able to have multiple UserLayers

Brent Owens
(The Open Planning Project)

Lee Wai See wrote:

Hi,

Can I have two <UserLayer> tags in one SLD, as follows? I have tried but it seems like no map is returned.

http://localhost:8080/geoserver/wms?bbox=103.59736493356376,1.1786672415708097,104.09707604959173,1.4807073969316509&Format=image/png&request=GetMap&width=800&height=400&srs=EPSG:4326&SLD_BODY=
<StyledLayerDescriptor version=“1.0.0”>
            <UserLayer>
                           <Name>prrm:history_track</Name>
                           <UserStyle>
                                          <Title>Default Styler</Title>
                                          <Abstract></Abstract>
                                          <FeatureTypeStyle>
                                                          <FeatureTypeName>Feature</FeatureTypeName>
                     </FeatureTypeStyle>
              </UserStyle>
      </UserLayer>
      <UserLayer>
                           <Name>prrm:vehicle_map</Name>
                           <UserStyle>
                                          <Title>Default Styler</Title>
                                          <Abstract></Abstract>
                                          <FeatureTypeStyle>
                                                         <FeatureTypeName>Feature</FeatureTypeName>
                     </FeatureTypeStyle>
             </UserStyle>
      </UserLayer>
</StyledLayerDescriptor>

Would appreciate any help. Thank you.

Regards,
Lee Wai See
ST Electronics (Info-Software Systems) Pte Ltd

[This e-mail is confidential and may be priviledged. If you are not the
intended recipient, please kindly notify us immediately and delete the message
from your system; please do not copy or use it for any purpose, nor disclose
its contents to any other person. Thank you.]
---ST Electronics Group---