Opened 19 years ago

Closed 17 years ago

#1007 closed defect (fixed)

WMS GetLegendGraphic and out of scale layers (or empty legends)

Reported by: dmorissette Owned by: mapserverbugs
Priority: high Milestone: 5.0 release
Component: WMS Server Version: 4.3
Severity: normal Keywords:
Cc: silke@…, bartvde@…, valik.solorzano.barboza@…

Description (last modified by dmorissette)

In bug 1006 and bug 809 we have run into the following situations:

- In bug 1006, an exception could be returned (GD error) if the specified layer
doesn't contain at least one class with a name. (Unable to create in a legend
image of 0 pixels high).

- In bug 809 it was reported that the GetLegendGraphic SCALE parameter should
not result in an empty legend. Bart copied the following to bug 1006:

> Also, here is a response from Craig Bruce from Cubewerx on the wms-dev list 
> (Sept 2004). What the Cubewerx server does is also an option I guess:
> 
> "The legend/scale determination can be done by the client.  It can examine
> the rules to determine if a layer/rule shows anything or not.  However,
> if a GetLegendGraphic request is actually sent to a server for a layer
> that will display nothing because of scale rules, then we can assume that
> the client is not entirely smart enough to filter it out and that it is
> probably expecting to receive back and display an image.  The best thing
> for the server to do is to return an image that somehow indicates that
> you will see nothing on the map for the layer/rule.  CubeWerx returns a
> small image with the letters "N/A" painted into it."


I'm thinking of solving both issues at once by modifying msDrawLegend() to
generate a small image with the letters "N/A" in it when the legend would have
been empty. This change would also impact on the CGI, but shouldn't create any
bad side-effect for anyone since the current situation is a fatal error in this
case.

Change History (5)

comment:1 by dmorissette, 19 years ago

Milestone: 4.6 release
Too late to do this in 4.4. But that would be important so I'll mark this as 4.6
target milsetone.

comment:2 by silke@…, 19 years ago

Cc: silke@… added

comment:3 by tomkralidis, 19 years ago

I agree "N/A" would be appropriate.  Should we set for 4.8?

comment:4 by tomkralidis, 17 years ago

is this a small enough fix for 5.0? (yes I'm refreshing this one)

comment:5 by dmorissette, 17 years ago

Description: modified (diff)
Resolution: fixed
Status: newclosed

I did a few more tests with the current 5.0 code in SVN, and GetLegendGraphic requests that result in an empty legend now produce a small empty image of about 35x5 pixels. The actual size may vary depending on KEYSIZE setting in legend.

Anyway, this seems like an acceptable behavior to me. I have also verified that versions 4.8 and 4.10 also did the same (I don't have any older build to check).

Closing as fixed.

Note: See TracTickets for help on using tickets.