[Mapserver-users] jBox applet - setimage

Richard Greenwood rich at greenwoodmap.com
Tue Jan 27 20:16:26 PST 2004


Steve McCrone wrote:

> Richard,
> 
> Here's my latest -
> 
> function setbox_handler(name, minx, miny, maxx, maxy, redraw) {
>       document.mapserv.imgbox.value = minx + " " + miny + " " + maxx + " " +
> maxy;
>       document.mapserv.imgxy.value = minx + " " + miny;
>       url =
> "http://localhost/cgi-bin/mapserv.exe?mode=map&map=C:/Inetpub/wwwroot/demo.m
> ap;
>       document.jBox.setimage(url);
>       }
> 
> The busy image does not appear, the map area appears to refresh, but with no
> zoom-in. I changed the layers to default, but the roads disappear when I
> zoom-in, even though it does not zoom.

Okay so it is working, right? That is, it is displaying the map when 
setimage(url)? If you want to alter the map (like zoom in) you have to 
do some more work. You will need to take the minx, miny, maxx, maxy 
values setbox_handler() and plug them into you url.

When you are working with an HTML form, the whole form, along with the 
form variables gets submitted to mapserver and processed. But when you 
use setimage, the only thing mapserver sees in in your url variable. 
Mapserver will not see what you have set with your 
document.mapserv.imgbox.value statement. So you have to do a lot more 
work formatting the url varibale than when you can pass all that info 
via form variables.

Same complexities on the return side: when you are using an HTML 
template, mapserver will calculate new map extents and lot of other 
useful stuff for you. But with setimage, you will need to do most of 
that on the client with javascript.

Regards,
-- 
Richard Greenwood
www.greenwoodmap.com




More information about the MapServer-users mailing list