[Chameleon] Problem with Scale widget

Paul Spencer pagameba at magma.ca
Thu Sep 23 09:14:13 EDT 2004


Jacob Delfos wrote:
> Berend,
>  
> Which version of chameleon are you using? I'm using my own scaletool 
> with a javascript calculation based on the current mapextents, and the 
> printsize. It then zooms to the newly calculated map-extents. 
> For latlong, I take into consideration the longitude. I use the same 
> calculation in CWC 1.0.4 as I do in chameleon 1.99, but only in version 
> 1.99 I managed to get to the same scale as the user enters. E.g. in CWC 
> 1.0.4, my calculated extent resulted in a scale slightly different from 
> what was 'predicted' (1:100005, in stead of 1:100000). I thought this 
> was due to a ronding error).
>  
> But in chameleon 1.99, I always get the right scale, even if it is 
> recalculating from 1:500 to 1:5000000. I use the same calculation, but 
> for some reason the mapextents can be set more precisely in 1.99. 
> Whatever has changed in chameleon 1.99 worked well for me, but did not 
> find its way into the normal scale widget.
>  
> Paul, where can I see the calculation for the scale widget? Do I need to 
> check the mapserver source code for this?

The basic logic is in htdocs/common/wrapper/map_navigator.php in the 
zoomScale function, this calculates the center of the map in pixels (so 
if you have a map size that is not an even number of pixels, what will 
it do?) and calls the mapscript function zoomscale on the map object:

http://mapserver.gis.umn.edu/doc42/phpmapscript-class-guide.html#MapObj

The mapscript function probably calls an internal mapserver function to 
actually set the extents from the requested location (pixel), geographic 
extents and scale ...

Cheers,

Paul



>  
> regards,
>  
> Jacob
>  
>  
>  
>  
>  
> -----Original Message-----
> From: chameleon-bounces at lists.maptools.org 
> <mailto:chameleon-bounces at lists.maptools.org> 
> [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Berend Veldkamp
> Sent: 23 September 2004 15:52
> To: Chameleon Users
> Subject: Re: [Chameleon] Problem with Scale widget
>  
> 
> Paul,
>  
> Apparently it depends on the values I use for the width and height of
> the MapWidget: with 780x537 the scale widget displays a value other than
> I typed, a change of one pixel in either width or height solves it.
>  
> BTW I'm not really concerned about the actual scale on screen, as long
> as the value I type in the scale editbox remains the same and scale
> dependent layers become visible at the right scale.
>  
> Berend
>  
> 
> Paul Spencer wrote:
>  > Berend,
>  >
>  > I'm not sure that the scale widget can zoom to an exact scale.  The
>  > scale is the relationship between units on the screen and units on the
>  > ground.  The scale calculations in mapserver take into account several
>  > factors, and the end result is an approximation of ground scale based on
>  > several assumptions concerning the dpi of the display and the distance
>  > of 1 degree at a given latitude (to name a couple).  So when zooming to
>  > a particular scale, this calculation is, in effect, reversed to
>  > determine how many ground units will fit inside a pixel and then the
>  > extents are set to match some approximation of this.
>  >
>  > That being said, I don't think the discrepancy should be as big as you
>  > are indicating here so perhaps there is a problem.  Please file a bug
>  > about this and I will try to take a look at it.
>  >
>  > Cheers,
>  >
>  > PAul
>  >
>  
> 
> -- 
> ____________________________
>  
> Berend Veldkamp - ARIS
> http://www.aris.nl/
> ____________________________
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org <mailto:Chameleon at lists.maptools.org>
> http://lists.maptools.org/mailman/listinfo/chameleon
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

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



More information about the Chameleon mailing list