Page 1 of 1

Visualization of map scale

Posted: Mon Oct 18, 2021 11:27 am
by Bernd Welter
Hi there,

in older versions of PTV based mapping interfaces there used to be a map scale on the bottom of the map. Now some players asked me where they could switch the visualization of the scale (on/off). The answer to that question is "that depends on the framework you use".

And here's why: through the years the visualization of mapping interfaces performed an evolution
  • from "single tile with control size"
  • to "multiple background tiles + global foreground layers" (both approaches had to deal with the non stable rendering)
  • and finally to a "multiple background tiles" (possible because we implemented stable rendering in xMap2)
With the last stage the necessity of "the map engine itself renders the scale" is no longer given. Nowadays the rendering of scales is done on the mapping framework in use, e.g. Leaflet or xServer.Net. I attached some screenshots so you can compare the output.
mash up approach
mash up approach
If your mapping framework doesn't support a scale from a native perspective you could use this code to determine
  • whether you want to display the scale or not (depends on the min/max latitude)
  • what scale to apply (based on the latitude of your choice)
Here's also some fancy code from Oliver that shows how we apply this native scale in xServer.NET.

Bernd