[Geoserver-devel] GeoServer 2.1.3 GetLegendGraphics fails on testsuite

Hi,

We've validated our GeoServer 2.1.3 setup (incl. INSPIRE plugin) with
the testsuite for the German Spatial Data Infrastructure (GDI-DE) [1].
All tests were successful, except one concerning the GetLegendGraphics
operation:

Requirement: The size of the LegendURL for Style X in Layer Y is 20x20.
Message: Error: The actual size of
'http://geoserver?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=Y
is 119x93

Obviously the interpretation of the width/height parameter in
GeoServer and the testsuite is different. So the key question is:
Should the width parameter (and height respectively) specify the width
of the complete image (as proposed in GEOS-2963) or just the width of
the "keyimage" (see GEOS-814)?

The testsuite requires the former behaviour but Geoserver implements
the latter.

I've checked the SLD spec [2] and it states the following concerning
the width/height parameter:
1) "This gives a hint for the width of the returned graphic in pixels.
Vector-graphics can use this value as a hint for the level of detail
to include."
2) "Width=300 | Optional | Positive integer pixel width of desired output".
3) It also includes an example that has a rule:
"http://www.vendor.com/wms.cgi?
VERSION=1.1.0&
REQUEST=GetLegendGraphic&
LAYER=ROADL_1M%3Alocal_data&
STYLE=my_style&
RULE=highways&
SLD=http%3A%2F%2Fwww.sld.com%2Fstyles%2Fkpp01.xml&
WIDTH=16&
HEIGHT=16&
FORMAT=image%2Fgif&
which would produce a 16x16 icon for the Rule named “highways” defined
within layer
“ROADL_1M:local_data” in the SLD..."

Well, the spec leaves room for interpretation.. I would interpret it
like this: WIDTH= should be the width of the keyimage if the request
contains a RULE= parameter, otherwise it should be the width of the
complete legend image. What do you think? Is this a "semantic bug" in
the testsuite or in GeoServer?

Regards,
Torsten

[1] GDI-DE Testsuite (login required): http://testsuite.gdi-de.org/gdi/
[2] Styled Layer Descriptor (SLD) 1.1:
http://portal.opengeospatial.org/files/?artifact_id=22364

On Tue, May 8, 2012 at 1:52 PM, thegis <thegis@…1310…> wrote:

Hi,

We’ve validated our GeoServer 2.1.3 setup (incl. INSPIRE plugin) with
the testsuite for the German Spatial Data Infrastructure (GDI-DE) [1].
All tests were successful, except one concerning the GetLegendGraphics
operation:

Requirement: The size of the LegendURL for Style X in Layer Y is 20x20.
Message: Error: The actual size of
http://geoserver?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=Y
is 119x93

Obviously the interpretation of the width/height parameter in
GeoServer and the testsuite is different. So the key question is:
Should the width parameter (and height respectively) specify the width
of the complete image (as proposed in GEOS-2963) or just the width of
the “keyimage” (see GEOS-814)?

The testsuite requires the former behaviour but Geoserver implements
the latter.

I’ve checked the SLD spec [2] and it states the following concerning
the width/height parameter:

  1. “This gives a hint for the width of the returned graphic in pixels.
    Vector-graphics can use this value as a hint for the level of detail
    to include.”
  2. “Width=300 | Optional | Positive integer pixel width of desired output”.
  3. It also includes an example that has a rule:
    http://www.vendor.com/wms.cgi?
    VERSION=1.1.0&
    REQUEST=GetLegendGraphic&
    LAYER=ROADL_1M%3Alocal_data&
    STYLE=my_style&
    RULE=highways&
    SLD=http%3A%2F%2Fwww.sld.com%2Fstyles%2Fkpp01.xml&
    WIDTH=16&
    HEIGHT=16&
    FORMAT=image%2Fgif&
    which would produce a 16x16 icon for the Rule named “highways” defined
    within layer
    “ROADL_1M:local_data” in the SLD…”

Well, the spec leaves room for interpretation… I would interpret it
like this: WIDTH= should be the width of the keyimage if the request
contains a RULE= parameter, otherwise it should be the width of the
complete legend image. What do you think? Is this a “semantic bug” in
the testsuite or in GeoServer?

As you said, the spec says it’s just a hint, which means the server is free to
respond as it pleases.

Your interpretation is also correct, if there is a single rule requested we
suppose the client is building the legend and don’t add extras, if not
we suppose the whole style is to be depicted and as a result we return
a bigger legend. But as said, it’s a matter of interpretation and practicality,
what’s binding is that the spec says width/height are just hints, which
leaves each implementation to work out the details as it sees fit.

Imho the test suite you’re citing is too strict and non conformant to
the specification requirements

Cheers
Andrea


Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

At this moment in geoServer 2.1.3 "getLegendGraphic" has no use or little use
for the people who are using more than one layer because when you send a
parameter "width" you can never know the result picture size and your html
content cannot be prepared for these graphics.

I mean what is the meaning of giving "width" parameter if we will not know
image size?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/GeoServer-2-1-3-GetLegendGraphics-fails-on-testsuite-tp4960329p5001337.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.