OpenStreetMap 로고 OpenStreetMap

Zero-waste Shops

SomeoneElse님이 English로 2022년 2월 13일에 게시함. 최근 2022년 6월 1일에 업데이트됨.

Food shop icons with 3 zero-waste versions

Over at map.atownsend.org.uk I use a wider variety of icons for different sorts of objects within OSM. I previously explained here how simple changes to a basic icon make it still recognisable as the basic object (“this is a pub”) but also convey more information (“this particular pub is wheelchair accessible, and has a beer garden”).

The same principle can be used with “shop” icons - a selection of different types of shops can be shown differently if they have one of the tags commonly used in OSM to indicate “zero waste” or “eco” shops. This is done here in the lua file that processes all OSM data before loading into the rendering database. In the case of “zero waste supermarkets”, the code looks like this:

if ((  keyvalues["shop"]               == "supermarket"         ) and
    (( keyvalues["zero_waste"]         == "yes"                )  or
     ( keyvalues["zero_waste"]         == "only"               )  or
     ( keyvalues["bulk_purchase"]      == "yes"                )  or
     ( keyvalues["reusable_packaging"] == "yes"                ))) then
   keyvalues["shop"] = "ecosupermarket"
end

Then all that we need to do is to create a new icon and make sure that that icon is used:

[shop = 'ecosupermarket'][zoom >= 16]::shop {
  point-file: url('symbols/shop_ecosupermarket.p.16.png');
  point-placement: interior;
}

and that the name for “ecosupermarkets” is displayed just like it is for “supermarkets”:

[shop = 'supermarket']::shop,
[shop = 'ecosupermarket']::shop,
[shop = 'department_store']::shop {
  [zoom >= 16] {
    text-name: "[name]";
    text-size: 9;
    [zoom >= 20] { text-size: 18; }
    text-dy: 11;
    text-fill: #939;
    text-face-name: @book-fonts;
    text-halo-radius: 1;
    text-wrap-width: 20;
    text-placement: interior;
  }
}

The “lua” script is called for every object whenever the database is reloaded, and also called every time it is updated with whatever people have edited in OSM, which typically happens 5 minutes or so after the edit takes place.

위치: Woodhouse Cliff, Hyde Park, Leeds, West Yorkshire, England, LS6 2EZ, United Kingdom
이메일 아이콘 Bluesky 아이콘 Facebook 아이콘 LinkedIn 아이콘 마스토돈 아이콘 텔레그램 아이콘 X 아이콘

토론

댓글을 남기려면 로그인하세요