Hi Tamas,

OK noted re-backwards compatibility and stability between requests - seems 
safest to make this a new keyword / option.

If the performance cost is negligible then a user can pick whichever approach 
is most suitable without worrying about performance (which is good!).

Middle-of the map seems the cleanest approach.

Thanks for addressing my questions (and a pre-emptive +1 from me),

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @[email protected]

On Sun, May 17, 2026, at 1:48 PM, Tamas Szekeres wrote:
> Hi Seth,
> 
> Thank you for the feedback, see my comments inline:
> 
>> 
>> I'd agree with Even's point that using the "geodesic" approach for any 
>> projected map would make sense - or is there a situation where you'd want a 
>> Cartesiam scalebar drawn? Maybe to have consistency between requests?
>> 
> 
> Geodesic measurement is likely the better default for most projected maps 
> intended to show real-world ground distance, especially EPSG:3857. However, 
> preserving cartesian measurement gives users a deterministic 
> legacy-compatible option where the scalebar represents map units directly and 
> remains stable across requests. This is useful for existing applications, 
> tests, cached map output, or workflows where projected coordinates rather 
> than ellipsoidal ground distance are the intended reference.
>  
>> 
>> I guess the new approach could slow down the generation of the scalebar, but 
>> as embedded scalebars are part of full Map requests (and not WFS etc.), it 
>> wouldn't affect most uses of MapServer. 
>> 
> 
> The added cost should be negligible for normal embedded scalebars. A geodesic 
> scalebar currently adds two coordinate transformations and one proj_geod() 
> call per scalebar fitting iteration, usually only one or a few iterations per 
> rendered map. This is tiny compared with a full map render, although we can 
> mention that pathological scalebar-only or repeated-render benchmarks may 
> show a measurable difference.
>  
>> 
>> Using the middle of the map for the scale seems the simplest option. If a 
>> user renders a world-wide Web Mercator map, and the scalebar is in the 
>> top-left of the map, then using pixels at this location would create a 
>> scalebar based on pixels with high latitudes and a 100 KM scalebar could 
>> represent 50 KM on the ground. Using the map center would produce a 
>> scalebar, only accurate at the equator, but at least consistent with the 
>> current implementation.
>> 
> 
> I agree with this standpoint and adjust the RFC/implementation accordingly: 
> geodesic mode should sample at the map center, while POSITION/OFFSET should 
> remain purely visual layout controls.
> 
> Best regards,
> 
> Tamas
> 
_______________________________________________
MapServer-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-dev

Reply via email to