[Mapserver-users] jBox applet - setimage

Richard Greenwood rich at greenwoodmap.com
Wed Jan 28 08:52:06 PST 2004


Steve McCrone wrote:
> Richard,
> 
> Yes, I have determined it is working.now I just have to figure out how to
> include the map sixe, extants etc. I have experimented but no luck yet.
> 
> Thanks a lot for your help.
> 
> Steve

There are two routes that you can go. The one I alluded to in my 
previous email (below) is to calculate all that stuff yourself, on the 
client, with javascript. It's a lot of work. I'd start with Steve Lime's 
Landview js as it is the best and most sophisticated example I've seen.

The other way is a lot easier, but a bit less elegant because it 
involves two calls to the server for each map update, and would probably 
require using frames. Here's the general idea: When you need to display 
a new map due to a new zoom or whatever, submit the new parameters to 
mapserver in hidden form variables in the usual manner, have mapserver 
create the new image, calculate the new map extents and anything else, 
and get this information (including the name of the newly created image) 
back in hidden form variables in a frame. Then grab the new image name 
and put it into the url for setimage(), then call setimage() from your 
main map frame. In this case setimage() is pointed at the image file on 
the server's hard disk that was created in the previous request, rather 
than the more typical situation in which setimage() is calling mapserver 
directly with mode=map.

Rich


>>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
>>
> 
> 
> 
> 


-- 
Richard Greenwood
www.greenwoodmap.com



More information about the MapServer-users mailing list