2

I am trying to display a simple inline feature on top of other features with geoserver. I need the top feature to be defined through sld. The sld does'nt give me any error but also does not display the inline feature. What could be wrong in my sld or request?

Here is the sld:

<sld:StyledLayerDescriptor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                           xsi:schemaLocation="http://www.opengis.net/sld
                                               http://giswebservices.massgis.state.ma.us/geoserver/schemas/sld/StyledLayerDescriptor.xsd"
                           xmlns:gml="http://www.opengis.net/gml"
                           xmlns:sld="http://www.opengis.net/sld" version="1.0.0">
  <sld:NamedLayer>
    <sld:Name>myWor:polygons</sld:Name>
    <UserStyle xmlns="http://www.opengis.net/sld">
      <FeatureTypeStyle>
        <Rule>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#000000</CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">#FFFFFF</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </sld:NamedLayer>
  <sld:UserLayer>
    <sld:Name>Inline</sld:Name>
    <sld:InlineFeature>
      <sld:FeatureCollection>
        <sld:featureMember>
          <polygonProperty>
            <sld:InlineFeature>
              <sld:FeatureCollection>
                <sld:featureMember>
                  <polygonProperty>
                    <gml:Polygon>
                      <gml:outerBoundaryIs>
                        <gml:LinearRing>
                          <gml:coordinates>-100,50 -90,60 -100,60 -100,50</gml:coordinates>
                        </gml:LinearRing>
                      </gml:outerBoundaryIs>
                    </gml:Polygon>
                  </polygonProperty>
                </sld:featureMember>
              </sld:FeatureCollection>
            </sld:InlineFeature>
          </polygonProperty>
        </sld:featureMember>
      </sld:FeatureCollection>
    </sld:InlineFeature>
    <sld:LayerFeatureConstraints>
      <sld:FeatureTypeConstraint/>
    </sld:LayerFeatureConstraints>
    <sld:UserStyle>
      <sld:Name>test style</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:PolygonSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#FF0000</CssParameter>
              <CssParameter name="stroke-width">2</CssParameter>
            </Stroke>
          </sld:PolygonSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </sld:UserLayer>
</sld:StyledLayerDescriptor>

and here is the request (the bounding box parameter changes as I am displaying the data as tiles on google maps):

http://localhost:8080/geoserver/wms?&service=WMS&version=1.1.1&request=GetMap&layers=myWor:polygons&styles=inline&format=image/png&srs=EPSG:4326&TRANSPARENT=TRUE&bbox=-150,40,-40,90&width=500&height=500

As a result I see the polygons: enter image description here but not the inline feature that should be a polygon on top of other polygons. Any ideas why?

  • from a quick glance it looks like your entire bbox is within the polygon which is unfilled so there is nothing to see? – Ian Turton Feb 29 '16 at 16:41
  • no, this is not the problem. As I mentioned in the question - this was just a url of one tile request - the inline feature does not show up on any of the tiles. For clarification I will change the url and sld in the question – P.P. Feb 29 '16 at 16:57
4

Your SLD is stored in the configuration, and you are assuming that you can call it by name.

That's not how it works. User layers can only be used when you are making POST requests for your GetMap, as in the example provided in the GeoServer demo requests.

SLDs stored in the configuration are just sources of UserStyle, everything else gets stripped away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.