paalkr wrote:
Hi!

This issue is quite important to us, does anybody feel like contracting the
task of fixing this? Please contact me by email if interested,
pal.kristensen at statkart.no


(For reference, the original post is available at
http://n2.nabble.com/Layer-scale-problem-with-Mercator-EPSG-900913-td2575585.html)

You get this kind of effect because MapServer bases its scale calculation on the units of the output projection, and not on the location of your map on the sphere... it basically trusts the fact that if your projection says "meter" then we can trust the units to really be meters on the ground and base the scale on that. The problem in your example is that for the area of your map, one unit/meter is not the same size in UTM33 and in Mercator... at the equator one unit of the Mercator projection is about one meter on the ground, but as you move up North, this is no longer true, and one unit covers more like 2, 3 or more meters on the ground.

So I'd be tempted to say that this is not a MapServer problem, it's a poor projection choice problem, since your projection is lying to you on the size of a unit/meter for the area of the world you are looking at.

It seems that to work around this we'd need an option in MapServer to enable the concept of "true scale", based on the center of the map on the sphere and not on the size of the projection units at the equator (or wherever the projection's units are true), basically bypassing the projection's definition of what a meter is for your part of the world. Note that this would work around the current issue but would come with its own side-effects: if you draw tiles using "true scale" in Mercator or EPSG:4326 in OpenLayers, then the "true scale" of each tile will not be the same, and the tiles in the North part of the map may not show the same layers as the ones at the equator... so "true scale" could be useful for single tile mapping only and not for tiled mapping interfaces.

All that being said, I played a few years ago with a similar idea to have a more meaningful scale when you use lat,lon coordinates in degrees, basically basing the scale on the latitude of the center of the current map view, but I abandoned the idea when I saw the side-effects (layers turning on and off) as you pan North/South. There is still code in MapServer's msInchesPerUnit() function (mapproject.c) that is currently #ifdef'd that would work for UNITS DD if you enable it.

I'd suggest you try enabling this code (recompile with -DENABLE_VARIABLE_INCHES_PER_DEGREE and then retest with EPSG:4326. If that fixes the issue for the EPSG:4326 case (I think that will), then we could talk about making this an official option in MapServer, and making it work for projected coordinate systems in addition to DD.

Daniel
-
Daniel Morissette
http://www.mapgears.com/
_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to