[mapserver-users] How Can I Get More Control over getLegendGraphic?

Andy Colson andy at squeakycode.net
Mon Nov 30 16:03:08 EST 2009


Bill Thoen wrote:
> I'm trying to build a custom legend with MapServer (and OpenLayers plus 
> some custom JS and PHP) and I'm using the getLegendGraphic request to 
> get the graphic pieces for the legend. However, I've got some layers 
> with data from 2003, 2005 and 2009 (3 separate layers) that I want to 
> represent on the legend with their common style and one label  (e.g. 
> Forest Lands instead of 3 icons labeled "Forest Lands 2003", "Forest 
> Lands 2005", "Forest Lands 2009").
> 
> I tried making a group layer, but getLegendGraphic() didn't like this 
> and it returned null.
> Is there a way I can specify both the style icon and the label? Or is 
> there some other way to do this?
> 
> Help would be appreciated (as it always is).
> 
> Thanks,
> 

I kinda ran into this.  I wanted to "specialize" my legend too.  I end 
up just copying my mapfile to legend.map and editing it to my tastes and 
using that to generate the legend instead of the real mapfile.

Not sure if it'll help...

-Andy


More information about the mapserver-users mailing list