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

Thomas Bonfort thomas.bonfort at gmail.com
Fri Mar 7 01:44:14 PST 2014



On 07/03/2014 10:33, Tamas Szekeres wrote:
> Thomas,
> 
> It is indeed a problem that the scale may vary across a given view, but
> with the current approach in most cases the reported scale is not falling
> between the minimum and the maximum, which seems to be incorrect.
I don't understand that part (minimum, maximum), can you be more precise?

> It would
> me more reasonable to use something like what Paul is mentioning with the great
> circle distance calculation.
If this is going to be used for the scalebar computation, I'm fine with
that. For the scaledenom calculation given a map request, the calculated
scale for a (Wi,Hi) pixels image of extent size (We,He) should remain
strictly identical for a given Wi,Hi,We,He,units , whatever the actual
longitude/latitude values where used to compute We and He, for the
reasons I explained in my previous email.

--
thomas

> 
> Best regards,
> 
> Tamas
> 
> 
> 
> 2014-03-07 10:19 GMT+01:00 Thomas Bonfort <thomas.bonfort at gmail.com>:
> 
>> 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
>>>
>> _______________________________________________
>> 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