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

Thomas Bonfort thomas.bonfort at gmail.com
Fri Mar 7 01:19:21 PST 2014


Tamas,
Adding to what Paul said about the need to maintain a list of
projections with their respective deformations (which can be dependant
of longitude also, not only latitude), introducing extent based scale
calculation also implies that your map rendering may change drastically
(by switching from one scale-delimited layer to the next) by just having
the user do a 1-pixel pan in the vertical direction. This would also be
incompatible with any tiling software as the content of a given tile
will depend on many external factors (the size of a metatile being one)
and will therefore not be consistent with a neighboring tile.

If you went that way, how would you account for the fact that the scale
at the top of an image is different from the scale at the bottom of it?

Maybe you can work-around your specific need by having a scale
computation function given a projection, size and extent, and then using
that programmatically to select which layers/styles you need.
But in terms of the scaledenom usage in mapserver, it should stay as it
is now (and ENABLE_VARIABLE_INCHES_PER_DEGREE left disabled by default).

Best regards,
thomas

On 06/03/2014 16:49, Tamas Szekeres wrote:
> 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
> 


More information about the mapserver-dev mailing list