Feature update (v4.7): Width/Offset of lines in world meters instead of pixels

Submitted by plepe on

A current update allows symbols to use the scale of the current map view for parameters (e.g. for width or offset of lines). To demonstrate these features, the "Railway gauge" category now shows the rails with the correct offsets (although the exact configuration for multi-gauge rails is neither mapped nor evaluated) (available from zoom level 18). Code. Example.

Details:

  • The value map.metersPerPixel, which measures the size of the pixel at the viewport center in meters, is now available for twig templates. From this you can calculate the width or the offset of a line in meters. E.g. you could use {{ max(5, 3 / map.metersPerPixel) }} as value for width: 3 meters, or at least 5 pixels.
  • Related to the first feature, you can now also specify the value of certain style parameters (width, offset, ...) with a unit: 'px' (for screen pixels) and 'm' (world meters).

See the README for details.