1

I want to reproject data via sld:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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>RAIN_SLD</Name>
    <UserStyle>
      <Title>RAIN</Title>
      <FeatureTypeStyle>
        <Transformation>
          <ogc:Function name="gs:BufferFeatureCollection">
            <ogc:Function name="parameter">
              <ogc:Literal>features</ogc:Literal>
              <ogc:Function name="gs:Reproject">
                <ogc:Function name="parameter">
                  <ogc:Literal>features</ogc:Literal>
                </ogc:Function> <!-- end parameter -->
                <ogc:Function name="parameter">
                  <ogc:Literal>forcedCRS</ogc:Literal>
                  <ogc:Literal>EPSG:4326</ogc:Literal>
                </ogc:Function> <!-- end parameter -->
                <ogc:Function name="parameter">
                  <ogc:Literal>targetCRS</ogc:Literal>
                  <ogc:Literal>EPSG:900913</ogc:Literal> <!-- end parameter -->
                </ogc:Function> <!-- end targetCRS -->
              </ogc:Function> <!-- end reporject -->
            </ogc:Function> <!-- end parameter -->
            <ogc:Function name="parameter">
              <ogc:Literal>distance</ogc:Literal>
              <ogc:Function name="env">
                <ogc:Literal>BUFFER_DIS</ogc:Literal>
                <ogc:Literal>10000</ogc:Literal>
              </ogc:Function>
            </ogc:Function> <!-- end parameter -->
          </ogc:Function>
        </Transformation>

        <Rule>
          <Name>BUFFER</Name>
          <Title>BUFFER</Title>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>SN</ogc:PropertyName>
              <ogc:Literal>A0001</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>

          <PolygonSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#d3d3d3</CssParameter>
              <CssParameter name="stroke-width">2</CssParameter>
            </Stroke>
          </PolygonSymbolizer>

          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#ff0000</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

When i requested the layer with the SLD above, i got an error:

Could not convert the value EPSG:4326 into the expected type interface org.opengis.referencing.crs.CoordinateReferenceSystem for parameter forcedCRS.

I found an example: Geoserver: Georectification via SLD fails

It is useful. But in my situation, 2 CRSs(forcedCRS and targetCRS) must be set.

How could I do with it?

1

The forcedCRS is associated in the layer configuration, so i just specified the targetCRS.

How to use "gs:Reproject" in sld ? And I checked the "WPS request builder" demo in GeoServer, the parameter "forcedCRS" was override if specified.

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.