開放街圖標誌 OpenStreetMap 開放街圖

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.

Map showing single and dual gauge tramway tracks in Sofia, Bulgaria Map showing single and dual gauge tramway tracks in Sofia, Bulgaria

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.md for details.

電子郵件圖示 藍天圖示 Facebook 圖示 LinkedIn 圖示 乳齒象圖示 Telegram 圖示 X 圖示

討論

imagico2020年01月27日 10時58分 發表的評論

Impressive. This is the first map rendering framework i know of that offers native support for ground unit rendering - even if only in Mercator apparently.

We tried doing something like this in OSM-Carto some time ago but decided against it because of the complexity due to the lack of native support for this in Mapnik/CartoCSS.

skunk2020年01月27日 12時01分 發表的評論

Hi!

Thanks for your feedback :-) Yeah, the approach clearly has limitations, as it always uses the scale at the map center. But for high zoom levels this should be sufficient.

Btw, the logic is also present in the module overpass-layer (which is used by OpenStreetBrowser). You can use this to create overlays based on OpenStreetMap data.

登入 來留下評論