[ka-Map-users] maintaining scale/extent when switching maps

Steve Lime Steve.Lime at dnr.state.mn.us
Thu Jul 6 12:25:55 EDT 2006


I knew it was something stupid like that (array context)- thanks, works now. BTW You can see
ka-map in a conservation publication our organization does at:

  http://www.dnr.state.mn.us/volunteer/julaug06/wildriver.html

Steve

>>> Paul Spencer <pspencer at dmsolutions.ca> 7/4/2006 12:15:18 PM >>>
Steve,

looking at the code, this won't work because it is expecting an array  
of values, not individual value

As a side note, the most reliable way of doing this would be to pass  
the center point and scale rather than the extents because rounding  
issues can cause the map to zoom out one scale level (it tries to fit  
the extents inside view).

function mySwitchMap(map) {
   var extents = myKaMap.getGeoExtents();
   var cx = (extents[2] + extents[0])/2;
   var cy = (extents[3] + extents[1])/2;
   var scale = myKaMap.getCurrentScale();
   myKaMap.selectMap(map, [cx, cy, scale]);
}

Cheers

Paul

On 29-Jun-06, at 5:08 PM, Steve Lime wrote:

> Hi folks: Is there an easy way to maintain scale/extent in the  
> viewport when switching maps? I figured one could do something like:
>
> function mySwitchMap(map) {
>   var extents =  myKaMap.getGeoExtents();
>
>   myKaMap.selectMap(map, extent[0], extent[1], extent[2], extent[3]);
> }
>
> The map switches (although IE needs a mouse click to trigger the  
> switch) but the viewport doesn't preserve the old extent...
>
> Ideas?
>
> Steve
>
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/ka-map-users 

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/| 
+-----------------------------------------------------------------+




_______________________________________________
ka-Map-users mailing list
ka-Map-users at lists.maptools.org 
http://lists.maptools.org/mailman/listinfo/ka-map-users




More information about the ka-Map-users mailing list