[mapserver-dev] Re:#3265 - Scale dependent layer switching error with Mercator

Brent Fraser bfraser at geoanalytic.com
Thu Apr 29 11:24:45 EDT 2010


Thomas,

   I've run into some scaling issues as well:
     - measuring features visible in imagery
     - producing a PDF map at particular scale from a web mapping interface

The problem is in using Google's Mercator projection, zooming into an area 
around 50 degrees North and measuring, a ground feature known to be one mile in 
length measures 1.6 miles.

As Daniel pointed out in a previous email, it's not strictly a Mapserver 
problem.  Mapserver assumes that one meter in the projected coordinate system is 
one meter on the ground for any extent it is rendering.  It is a necessary 
approximation since it has no ability to get the map projection's point scale 
factor at a location.

   A better approximation would be ask the projection library for the point 
scale factor at the center of the current (or perhaps average the four 
corners?), then multiply the projecton scale to get a "ground" scale. 
Unfortunately proj4 does not expose a function to return the point scale factor. 
  Last week I asked for thoughts on the proj4 list, but didn't get much of a 
response.  It would be a simple thing (I think) to implement it for Spherical 
Mercator and UTM projections (and set all other projection's point scale factor 
to one for now?  return an error code?).

   To address Daniel's problem of layers dis/appearing as you pan north/south, 
Mapserver could hold the scale fixed then calculate the new extents.  This 
change may be a larger impact, I'm not sure.  And I think it would solve your 
problem as well.

   The measure problem is more of a client-side issue, but the same point scale 
function could be implemented in proj4js.  The distance calculation could get 
tricky for long distances and with non-conformal projections; but even the 
simplest approximation using the point scale factor would be better than what we 
have now.

Best Regards,
Brent Fraser



relet wrote:
> Hi all,
> 
> I have been trying to solve an issue we have with the mapserver rendering
> detail level when using different projections and the MAXSCALEDENOM limits.
> 
> http://osgeo-org.1803224.n2.nabble.com/Layer-scale-problem-with-Mercator-EPSG-900913-td2575585.html
> 
> To this aim, I have implemented the idea mentioned there by Pål, to specify
> different scale denominator limits for different projections
> 
> http://trac.osgeo.org/mapserver/ticket/3265
> 
> Now I am struggling to find a good place in the Mapfile syntax for this.
> Currently, I have crudely attached the projection string to the
> MAXSCALEDENOM parameter, where it is possibly the most straightforward for
> people who need this feature. But as Daniel correctly pointed out, it's a
> quite specific implementation, and no reason to extend the general syntax. 
> 
> The same argument would certainly apply to the internal objects. E.g.
> layerObj, where I grouped the various scale denominators with a scaleObj, to
> be able to store several of them in a hashtable, indexed by the epsg codes. 
> 
> Hence, I am looking forward to any suggestions how to contribute this
> feature in a generic, but user-friendly way. 
> 
> Thank you all in advance, 
> best regards,
> Thomas



More information about the mapserver-dev mailing list