legend scale dependency issues

Daniel Morissette dmorissette at MAPGEARS.COM
Tue Feb 13 17:54:23 EST 2007


percy wrote:
> 
> When you zoom in on the map, the scale dependencies all work great for 
> the map, but the legend is always out of whack. I am using php/mapscript 
> to generate a processlegendtemplate() request. For debugging this issue, 
> I have also tried just a straight drawlegend() request and I get 
> similarly odd behavior. The geologic faults, which are set to show up at 
> a scale of 1:500,000 don't show up in the legend until zoomed in to 
> around 1:100,000. (though sometimes if I zoom in small increments, 
> they'll show up sooner...)
> 

The problem could be related to the order in which you make calls in 
your PHP script. The legend object uses the last calculated scale in its 
tests to decide which layer/classes to include in the legend, so if you 
call processlegendtemplate() before the extents and scale have been 
updated to reflect the last zoom operation then you could get this kind 
of behavior.

I just did a quick check in the code and $map->setExtent() does update 
the scale value, so if you call that with the right extents before 
processing the legend then you should be fine.

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/



More information about the mapserver-users mailing list