OpenStreetMap

Zero-waste Shops

Posted by SomeoneElse on 13 February 2022 in English. Last updated on 1 June 2022.

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.

Location: Woodhouse Cliff, Hyde Park, Leeds, West Yorkshire, England, LS6 2EZ, United Kingdom

Discussion

Log in to leave a comment