[mapserver-dev] Implementation of the msCalculateScale

Mohamed Saâd HESSANE saad.hessane at gmail.com
Thu Feb 17 11:33:57 EST 2011


@Steve Lime : Thank you for the graphic. So if i understand, the map is
generated with GDAL, which use the big extent, and the scale and scalebar
generated from mapeserver, which calculate it with the small extent.
According to my tests, it generate a 0.1% error in a 1/300000 scale. It's
not bad. But the best would be not have this error.


2011/2/17 Stephen Woodbridge <woodbri at swoodbridge.com>

> I thought there were some extensive discussions on msCalculateScale and
> this particular issue in the past. I don't remember if it was on the
> dev-list or in a ticket. If I recall, it was changed which caused
> significant regressions and the changed back because of them.
>
> I'm not opposed to a change, per say, but I would like to avoid the issues
> we had last time. If this is getting into 6.0, this would be a good
> departure point to make a backwards compatibility breaking change. But once
> 6.0 is released, we will need to maintain some compatibility within the 6.x
> family of releases and not introduce major compatibility issues.
>
> -Steve W
>
>
> On 2/17/2011 10:17 AM, Jan Hartmann wrote:
>
>> Interesting. Could this be added to the documentation? It's important
>> when you are scaling at pixel level. Would it make sense to add an
>> option for MapServer to treat extents the same way as GDAL?
>>
>> Jan
>>
>> On 2011-02-17 16:07, Lime, Steve D (DNR) wrote:
>>
>>>
>>> It’s due to how MapServer interprets extents. It uses a pixel-center
>>> model so you end up using width or height minus one in computations
>>> because
>>>
>>> an extent is from the center of the UL pixel to the center of LR pixel
>>> (you lose the “one” from the outside) . I’ve attached a graphic I
>>> created some time
>>>
>>> ago that illustrates the difference between a MapServer extent and the
>>> model GDAL and WMS use.
>>>
>>> Steve
>>>
>>> *From:*mapserver-dev-bounces at lists.osgeo.org
>>> <mailto:mapserver-dev-bounces at lists.osgeo.org>
>>> [mailto:mapserver-dev-bounces at lists.osgeo.org] *On Behalf Of *Mohamed
>>> Saâd HESSANE
>>> *Sent:* Thursday, February 17, 2011 4:41 AM
>>> *To:* mapserver-dev at lists.osgeo.org <mailto:
>>> mapserver-dev at lists.osgeo.org>
>>>
>>> *Subject:* [mapserver-dev] Implementation of the msCalculateScale
>>>
>>> Good morning everybody.
>>> I don't understand how the msCalculateScale function in mapscale.c is
>>> implemented.
>>> As far as I know, the scale is calculated from the relation :
>>> inches_in_screen / inches_in_reallity.
>>> inches_in_screen : depend on the DPI and the width of the map;
>>> inches_in_reality : depend on the map.extent, and the pixel size.
>>> So why the "width-1" at the line 96? For me just "width" is more
>>> correct. Perhaps I'm wrong.
>>> The branches 4.X have just "width" in their implementations (line 125).
>>> So why the center pixel is removed from calculation?
>>>
>>>
>>> _______________________________________________
>>> mapserver-dev mailing list
>>> mapserver-dev at lists.osgeo.org  <mailto: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
>>
>
> _______________________________________________
> 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/20110217/2bfca590/attachment.html


More information about the mapserver-dev mailing list