[ka-Map-users] Scale to viewport

Paul Spencer pspencer at dmsolutions.ca
Mon Jan 23 20:44:04 EST 2006


David,

zoomToExtents tries to find the best scale to fit the extents  
provided.  It will try to ensure that the extents are entirely  
visible.  It will only pick a scale that has been defined for the  
map.  If the greatest available scale does not accomodate the  
extents, it will use that scale anyway.  Is this the behaviour you  
are observing?  If yes, then try adding another scale above the  
largest one.  You could also take the maximum viewport size you  
expect and the maximum extents and try to calculate an appropriate  
maximum scale.

Cheers

Paul

On 23-Jan-06, at 3:36 PM, David Badke wrote:

> Using the CVS ka-Map version... I would like to be able to display  
> a map, initially scaled so that it just fits in the viewport ("best  
> fit"), leaving a few pixels around the edges. Of course, I don't  
> know the size of the viewport when I am defining the set of scale  
> factors to allow, and the viewport size could change during a  
> session. I also don't want to have to define a lot of scale factors  
> to match all possible viewport sizes! I had thought that the the  
> "zoom to full extent" button  and the kaMap.zoomToExtents function  
> would fit the image to the viewport, but if the scale factor  
> calculated by zoomToExtents based on the viewport size is greater  
> than the greatest defined scale factor, the greatest defined scale  
> factor is used, rather than the calculated factor. Is the  
> zoomToExtents function supposed to fit to the viewport? Or is there  
> some other method I am missing that will do this?
>
> David
>
> _______________________________________________
> 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/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list