Opened 19 years ago
Closed 19 years ago
#1141 closed defect (fixed)
GetLegendGraphic and Layers with status not defined
Reported by: | Owned by: | dmorissette | |
---|---|---|---|
Priority: | high | Milestone: | 4.8 release |
Component: | WMS Server | Version: | 4.4 |
Severity: | normal | Keywords: | |
Cc: | jmckenna@…, valik.solorzano.barboza@… |
Description
When issuing a GetLegendGraphic request on a layer without a status defined, no legend is displayed. If you issue a GetMap request on the layer, the Mapserver code probably turns the status of the layer to on so that it is displayed. Maybe this should also be changed for the GetLegendGraphic code, or maybe there should be a more general WMS or OWS mechanism for doing this?
Change History (9)
comment:3 by , 19 years ago
i was recently testing getlegendgraphic for the docs, and was baffled why one layer would not return a legendgraphic...it was in fact turned OFF in the server mapfile. I think this issue should be fixed to follow the getmap functionality, as Bart mentioned.
comment:4 by , 19 years ago
Cc: | added |
---|
comment:5 by , 19 years ago
Milestone: | FUTURE → 4.8 release |
---|
Running into this again, we really need to get this fixed. This should be such an easy fix, I could even do it if I had CVS commit rights ... In mapwms.c: for (i=0; i<map->numlayers; i++) { if (map->layers[i].name && strcasecmp(map->layers[i].name, pszLayer) != 0) { map->layers[i].status = MS_OFF; } } Change the above to: for (i=0; i<map->numlayers; i++) { if (map->layers[i].name && strcasecmp(map->layers[i].name, pszLayer) != 0) { map->layers[i].status = MS_OFF; } else if (strcasecmp(map->layers[i].name, pszLayer) == 0) { map->layers[i].status = MS_ON; } } I have tested this fix in my local copy. Can somebody please commit this?
comment:6 by , 19 years ago
To be on the safe side, also add a check on the name being set: else if (map->layers[i].name && strcasecmp(map->layers[i].name, pszLayer) == 0) { map->layers[i].status = MS_ON; }
comment:7 by , 19 years ago
Reading over it again, the second check is pretty useless now, so: else if (map->layers[i].name) { map->layers[i].status = MS_ON; }
comment:9 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in CVS HEAD (4.7) and branch-4-6 (will be in 4.6.1). There was already a loop searching for the layer by name, so to avoid two loops of strcasecmp() on layer names, I changed the second one to: /* turn this layer on and all other layers off, required for msDrawLegend() */ for (i=0; i<map->numlayers; i++) { if (i == iLayerIndex) map->layers[i].status = MS_ON; else map->layers[i].status = MS_OFF; }
Note:
See TracTickets
for help on using tickets.