[Geoserver-users] Coverage FeatureTypeName in WMS POST

I had no response on a previous request, so I try again: I noticed that a WMS POST request for a NamedLayer which is represented by a coverage (specifically a GeoTiff raster) needs a fixed FeatureTypeName, whose value is Feature. Is there any reason about this behaviour?

Thanks,
Mauro

Mauro Bartolomeoli ha scritto:

I had no response on a previous request, so I try again: I noticed that a WMS POST request for a NamedLayer which is represented by a coverage (specifically a GeoTiff raster) needs a fixed FeatureTypeName, whose value is Feature. Is there any reason about this behaviour?

I still have to look into this. In any case, if you don't specify the
prefix, the proper behaviour would be that GeoServer assumes you're
asking for a feature in the default namespace and thus automatically
add that prefix.
So it's either that you're asking for a coverage that's not in the
default namespace, or there is a bug. Can you confirm either of them?

Cheers
Andrea

This is the request that returns a blank image:

<GetMap xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:gml="http://www.opengis.net/gml&quot; service="WMS" xmlns:topp="http://www.openplans.org/topp&quot; version="1.3.0">
    <StyledLayerDescriptor version ="1.0.0">
        <NamedLayer>
            <Name>topp:test</Name>
            <UserStyle>
                <Name>test</Name>
                <FeatureTypeStyle>
                    <FeatureTypeName>test</FeatureTypeName>
                    <Rule>
                        <Name>test</Name>
                        <RasterSymbolizer>
                            <Opacity>1</Opacity>
                        </RasterSymbolizer>
                    </Rule>
                </FeatureTypeStyle>
            </UserStyle>
        </NamedLayer> </StyledLayerDescriptor>
    <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#3004&quot;&gt;
        <gml:coord>
            <gml:X>2318600.0</gml:X>
            <gml:Y>4852200.0</gml:Y>
        </gml:coord>
        <gml:coord>
            <gml:X>2325920.0</gml:X>
            <gml:Y>4858400.0</gml:Y>
        </gml:coord>
    </BoundingBox>
    <Output>
        <Format>image/png</Format>
        <Transparent>true</Transparent>
        <Size>
            <Width>800</Width>
            <Height>635</Height>
        </Size>
    </Output>
    <Exceptions>XML</Exceptions>
</GetMap>

This one returns the correct image:

<GetMap xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:gml="http://www.opengis.net/gml&quot; service="WMS" xmlns:topp="http://www.openplans.org/topp&quot; version="1.3.0">
    <StyledLayerDescriptor version ="1.0.0">
        <NamedLayer>
            <Name>topp:test</Name>
            <UserStyle>
                <Name>test</Name>
                <FeatureTypeStyle>
                    <FeatureTypeName>Feature</FeatureTypeName>
                    <Rule>
                        <Name>test</Name>
                        <RasterSymbolizer>
                            <Opacity>1</Opacity>
                        </RasterSymbolizer>
                    </Rule>
                </FeatureTypeStyle>
            </UserStyle>
        </NamedLayer> </StyledLayerDescriptor>
    <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#3004&quot;&gt;
        <gml:coord>
            <gml:X>2318600.0</gml:X>
            <gml:Y>4852200.0</gml:Y>
        </gml:coord>
        <gml:coord>
            <gml:X>2325920.0</gml:X>
            <gml:Y>4858400.0</gml:Y>
        </gml:coord>
    </BoundingBox>
    <Output>
        <Format>image/png</Format>
        <Transparent>true</Transparent>
        <Size>
            <Width>800</Width>
            <Height>635</Height>
        </Size>
    </Output>
    <Exceptions>XML</Exceptions>
</GetMap>

As you can see, the only difference is in the <FeatureTypeName> tag value (Feature instead of test). The coverage is in the default namespace (topp) and this is specified in the <NamedLayer> tag, so I think it could be a bug.

Andrea Aime wrote:

Mauro Bartolomeoli ha scritto:

I had no response on a previous request, so I try again: I noticed that a WMS POST request for a NamedLayer which is represented by a coverage (specifically a GeoTiff raster) needs a fixed FeatureTypeName, whose value is Feature. Is there any reason about this behaviour?

I still have to look into this. In any case, if you don't specify the
prefix, the proper behaviour would be that GeoServer assumes you're
asking for a feature in the default namespace and thus automatically
add that prefix.
So it's either that you're asking for a coverage that's not in the
default namespace, or there is a bug. Can you confirm either of them?

Cheers
Andrea

Mauro Bartolomeoli ha scritto:

This is the request that returns a blank image:

<GetMap xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:gml="http://www.opengis.net/gml&quot; service="WMS" xmlns:topp="http://www.openplans.org/topp&quot; version="1.3.0">
   <StyledLayerDescriptor version ="1.0.0">
       <NamedLayer>
           <Name>topp:test</Name>
           <UserStyle>
               <Name>test</Name>
               <FeatureTypeStyle>
                   <FeatureTypeName>test</FeatureTypeName>
                   <Rule>
                       <Name>test</Name>
                       <RasterSymbolizer>
                           <Opacity>1</Opacity>
                       </RasterSymbolizer>
                   </Rule>
               </FeatureTypeStyle>
           </UserStyle>
       </NamedLayer> </StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#3004&quot;&gt;
       <gml:coord>
           <gml:X>2318600.0</gml:X>
           <gml:Y>4852200.0</gml:Y>
       </gml:coord>
       <gml:coord>
           <gml:X>2325920.0</gml:X>
           <gml:Y>4858400.0</gml:Y>
       </gml:coord>
   </BoundingBox>
   <Output>
       <Format>image/png</Format>
       <Transparent>true</Transparent>
       <Size>
           <Width>800</Width>
           <Height>635</Height>
       </Size>
   </Output>
   <Exceptions>XML</Exceptions>
</GetMap>

This one returns the correct image:

<GetMap xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:gml="http://www.opengis.net/gml&quot; service="WMS" xmlns:topp="http://www.openplans.org/topp&quot; version="1.3.0">
   <StyledLayerDescriptor version ="1.0.0">
       <NamedLayer>
           <Name>topp:test</Name>
           <UserStyle>
               <Name>test</Name>
               <FeatureTypeStyle>
                   <FeatureTypeName>Feature</FeatureTypeName>
                   <Rule>
                       <Name>test</Name>
                       <RasterSymbolizer>
                           <Opacity>1</Opacity>
                       </RasterSymbolizer>
                   </Rule>
               </FeatureTypeStyle>
           </UserStyle>
       </NamedLayer> </StyledLayerDescriptor>
   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#3004&quot;&gt;
       <gml:coord>
           <gml:X>2318600.0</gml:X>
           <gml:Y>4852200.0</gml:Y>
       </gml:coord>
       <gml:coord>
           <gml:X>2325920.0</gml:X>
           <gml:Y>4858400.0</gml:Y>
       </gml:coord>
   </BoundingBox>
   <Output>
       <Format>image/png</Format>
       <Transparent>true</Transparent>
       <Size>
           <Width>800</Width>
           <Height>635</Height>
       </Size>
   </Output>
   <Exceptions>XML</Exceptions>
</GetMap>

As you can see, the only difference is in the <FeatureTypeName> tag value (Feature instead of test). The coverage is in the default namespace (topp) and this is specified in the <NamedLayer> tag, so I think it could be a bug.

Ah, I see.
In our base library, GeoTools, a Coverage is not a feature, meaning
it does not have a FeatureType. Yet, to play with SLD a FeatureType
is needed, so we have code that fakes out a FeatureType whose features
have two attributes, "geom" that has the grid bbox as a polygon, and
"grid" that contains the GridCoverage. The FeatureType itself its
called "GridCoverage" (it's created in a point where there is no knowledge of the GeoServer configured name).

When the rendering engine inspects the first request it compares
a rendering rule wanting for feature type "test" and finds out
that feature type is "GridCoverage", so the rule it's not applied.

In the second case is sees "Feature", which is the supertype for
all feature types, so a rule that asks for "Feature" is applied
to everything it comes by (the check performed is
the one of inclusion in a type hierarchy).

In fact our code could try to force the fake feature type name
to correspond to the grid coverage name, it would require
changes in both GeoTools and GeoServer but it can be done.
It could break people using "GridCoverage" as the type name, but
afaik this detail was never published and all our symbolizers
used "Feature" instead, so I guess we still have our hands
free for such a change.

I've created an issue to track this one:
http://jira.codehaus.org/browse/GEOS-1314

Cheers
Andrea