[mapserver-dev] Regarding to the scale calculation in MapServer

Paul Spencer pagameba at gmail.com
Thu Mar 6 17:55:56 PST 2014


There are a lot of non-scale preserving projections, I would think it would be difficult or impossible to accommodate them all and if you can't accommodate them all then it will be problematic to explain when the scaledenom is "correct" and when it isn't.  

The scalebar rendered by MapServer does accurately reflect the ground scale as far as I know so I would think it would be possible to accurately compute the ground scale based on how the scalebar is rendered (independently of the projection perhaps).

Another approach is to implement a great circle distance calculation like haversine or vicenty, reproject a point from the left and right edge in the center of the map to epsg:4326 and compute the real world distance across the pixel space, adjusting for the map's resolution.

Cheers

Paul
-- 
Paul Spencer
Sent with Airmail

From: Tamas Szekeres szekerest at gmail.com
Reply: Tamas Szekeres szekerest at gmail.com
Date: March 6, 2014 at 10:49:28 AM
To: mapserver-dev at lists.osgeo.org mapserver-dev at lists.osgeo.org
Subject:  [mapserver-dev] Regarding to the scale calculation in MapServer  

Hi Devs,

As far as I know certain projections require to modify the scale regarding to the latitude of the given view. For latlong and AFAIK for the web mercator (ie EPSG:3857, EPSG:900913) we might require to use cos(latitude) as the correction factor. 

With the current mapserver code, I don't see how this requirement is taken into account. For the units=MS_DD, I can see the following code fragment in the code in msInchesPerUnits (though this is not compiled in by default)


#ifdef ENABLE_VARIABLE_INCHES_PER_DEGREE
      if (center_lat != 0.0) {

        double cos_lat;
        cos_lat = cos(MS_PI*center_lat/180.0);

        lat_adj = sqrt(1+cos_lat*cos_lat)/sqrt(2.0);

      }
#endif


Shouldn't the correction be applied for the web mercator (units=MS_METERS) and probably for futher CRS-s as well? 

Should we anyway have ENABLE_VARIABLE_INCHES_PER_DEGREE defined by default?

Best regards,

Tamas


_______________________________________________  
mapserver-dev mailing list  
mapserver-dev at lists.osgeo.org  
http://lists.osgeo.org/mailman/listinfo/mapserver-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20140306/be1c179d/attachment.html>


More information about the mapserver-dev mailing list