Use icon of waste if only one is set

This commit is contained in:
Robin van der Linde 2022-02-19 22:52:52 +01:00
parent d49fd8df1f
commit 2e51a45668

View file

@ -11,6 +11,9 @@
"source": { "source": {
"osmTags": "amenity=recycling" "osmTags": "amenity=recycling"
}, },
"calculatedTags": [
"_waste_amount=Object.values(Object.keys(feat.properties).filter((key) => key.startsWith('recycling:')).reduce((cur, key) => { return Object.assign(cur, { [key]: feat.properties[key] })}, {})).reduce((n, x) => n + (x == \"yes\"), 0);"
],
"minzoom": 12, "minzoom": 12,
"title": { "title": {
"render": { "render": {
@ -40,89 +43,355 @@
"point", "point",
"centroid" "centroid"
], ],
"icon": "circle:white;./assets/layers/recycling/recycling-14.svg", "icon": {
"render": "circle:white;./assets/layers/recycling/recycling-14.svg",
"mappings": [
{
"if": {
"and": [
"_waste_amount=1",
"recycling:batteries=yes"
]
},
"then": "circle:white;./assets/layers/recycling/batteries.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:beverage_cartons=yes"
]
},
"then": "circle:white;./assets/layers/recycling/beverage_cartons.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:cans=yes"
]
},
"then": "circle:white;./assets/layers/recycling/cans.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:clothes=yes"
]
},
"then": "circle:white;./assets/layers/recycling/clothes.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:cooking_oil=yes"
]
},
"then": "circle:white;./assets/layers/recycling/cooking_oil.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:engine_oil=yes"
]
},
"then": "circle:white;./assets/layers/recycling/engine_oil.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:glass=yes"
]
},
"then": "circle:white;./assets/layers/recycling/glass.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:glass_bottles=yes"
]
},
"then": "circle:white;./assets/layers/recycling/glass_bottles.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
{
"or": [
"recycling:green_waste=yes",
"recycling:organic=yes"
]
}
]
},
"then": "circle:white;./assets/layers/recycling/garden_waste.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:newspaper=yes"
]
},
"then": "circle:white;./assets/layers/recycling/newspaper.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:paper=yes"
]
},
"then": "circle:white;./assets/layers/recycling/paper.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:plastic_bottles=yes"
]
},
"then": "circle:white;./assets/layers/recycling/plastic_bottles.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:plastic_packaging=yes"
]
},
"then": "circle:white;./assets/layers/recycling/plastic_packaging.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:plastic=yes"
]
},
"then": "circle:white;./assets/layers/recycling/plastic.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:scrap_metal=yes"
]
},
"then": "circle:white;./assets/layers/recycling/scrap_metal.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:shoes=yes"
]
},
"then": "circle:white;./assets/layers/recycling/shoes.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
{
"or": [
"recycling:small_appliances=yes",
"recycling:small_electric_appliances=yes"
]
}
]
},
"then": "circle:white;./assets/layers/recycling/small_electrical_appliances.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
"recycling:waste=yes"
]
},
"then": "circle:white;./assets/layers/waste_disposal/waste_disposal.svg"
}
]
},
"iconBadges": [ "iconBadges": [
{ {
"if": "recycling:batteries=yes", "if": {
"then": "circle:#FFFFFF;./assets/layers/recycling/batteries.svg" "and": [
}, "_waste_amount>1",
{ "recycling:batteries=yes"
"if": "recycling:beverage_cartons=yes", ]
"then": "circle:#FFFFFF;./assets/layers/recycling/beverage_cartons.svg" },
}, "then": "circle:white;./assets/layers/recycling/batteries.svg"
{
"if": "recycling:cans=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/cans.svg"
},
{
"if": "recycling:clothes=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/clothes.svg"
},
{
"if": "recycling:cooking_oil=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/cooking_oil.svg"
},
{
"if": "recycling:engine_oil=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/engine_oil.svg"
},
{
"if": "recycling:glass=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/glass.svg"
},
{
"if": "recycling:glass_bottles=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/glass_bottles.svg"
}, },
{ {
"if": { "if": {
"or": [ "and": [
"recycling:green_waste=yes", "_waste_amount>1",
"recycling:organic=yes" "recycling:beverage_cartons=yes"
] ]
}, },
"then": "circle:#FFFFFF;./assets/layers/recycling/garden_waste.svg" "then": "circle:white;./assets/layers/recycling/beverage_cartons.svg"
},
{
"if": "recycling:newspaper=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/newspaper.svg"
},
{
"if": "recycling:paper=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/paper.svg"
},
{
"if": "recycling:plastic_bottles=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/plastic_bottles.svg"
},
{
"if": "recycling:plastic_packaging=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/plastic_packaging.svg"
},
{
"if": "recycling:plastic=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/plastic.svg"
},
{
"if": "recycling:scrap_metal=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/scrap_metal.svg"
},
{
"if": "recyling:shoes=yes",
"then": "circle:#FFFFFF;./assets/layers/recycling/shoes.svg"
}, },
{ {
"if": { "if": {
"or": [ "and": [
"recycling:small_appliances=yes", "_waste_amount>1",
"recycling:small_electrical_appliances=yes" "recycling:cans=yes"
] ]
}, },
"then": "circle:#FFFFFF;./assets/layers/recycling/small_electrical_appliances.svg" "then": "circle:white;./assets/layers/recycling/cans.svg"
}, },
{ {
"if": "recycling:waste=yes", "if": {
"then": "circle:#FFFFFF;./assets/layers/waste_disposal/waste_disposal.svg" "and": [
"_waste_amount>1",
"recycling:clothes=yes"
]
},
"then": "circle:white;./assets/layers/recycling/clothes.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:cooking_oil=yes"
]
},
"then": "circle:white;./assets/layers/recycling/cooking_oil.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:engine_oil=yes"
]
},
"then": "circle:white;./assets/layers/recycling/engine_oil.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:glass=yes"
]
},
"then": "circle:white;./assets/layers/recycling/glass.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:glass_bottles=yes"
]
},
"then": "circle:white;./assets/layers/recycling/glass_bottles.svg"
},
{
"if": {
"and": [
"_waste_amount=1",
{
"or": [
"recycling:green_waste=yes",
"recycling:organic=yes"
]
}
]
},
"then": "circle:white;./assets/layers/recycling/garden_waste.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:newspaper=yes"
]
},
"then": "circle:white;./assets/layers/recycling/newspaper.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:paper=yes"
]
},
"then": "circle:white;./assets/layers/recycling/paper.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:plastic_bottles=yes"
]
},
"then": "circle:white;./assets/layers/recycling/plastic_bottles.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:plastic_packaging=yes"
]
},
"then": "circle:white;./assets/layers/recycling/plastic_packaging.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:plastic=yes"
]
},
"then": "circle:white;./assets/layers/recycling/plastic.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:scrap_metal=yes"
]
},
"then": "circle:white;./assets/layers/recycling/scrap_metal.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:shoes=yes"
]
},
"then": "circle:white;./assets/layers/recycling/shoes.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
{
"or": [
"recycling:small_appliances=yes",
"recycling:small_electrical_appliances=yes"
]
}
]
},
"then": "circle:white;./assets/layers/recycling/small_electrical_appliances.svg"
},
{
"if": {
"and": [
"_waste_amount>1",
"recycling:waste=yes"
]
},
"then": "circle:white;./assets/layers/waste_disposal/waste_disposal.svg"
} }
] ]
} }