From b4052b8f6355a2c6c8f5cbdce803d81e606807d3 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Wed, 6 Apr 2022 21:37:31 +0200 Subject: [PATCH] First version of transit/bus theme --- assets/layers/shelter/license_info.json | 12 + assets/layers/shelter/shelter.json | 88 ++++++ assets/layers/shelter/shelter.svg | 1 + assets/layers/shops/shops.json | 44 +-- .../layers/transit_routes/transit_routes.json | 141 ++++++++++ assets/layers/transit_stops/bus_stop.svg | 3 + assets/layers/transit_stops/license_info.json | 15 + .../layers/transit_stops/transit_stops.json | 260 ++++++++++++++++++ .../mapcomplete-changes.json | 8 +- assets/themes/transit/transit.json | 51 ++++ langs/layers/en.json | 183 ++++++++++++ langs/themes/en.json | 4 + 12 files changed, 788 insertions(+), 22 deletions(-) create mode 100644 assets/layers/shelter/license_info.json create mode 100644 assets/layers/shelter/shelter.json create mode 100644 assets/layers/shelter/shelter.svg create mode 100644 assets/layers/transit_routes/transit_routes.json create mode 100644 assets/layers/transit_stops/bus_stop.svg create mode 100644 assets/layers/transit_stops/license_info.json create mode 100644 assets/layers/transit_stops/transit_stops.json create mode 100644 assets/themes/transit/transit.json diff --git a/assets/layers/shelter/license_info.json b/assets/layers/shelter/license_info.json new file mode 100644 index 000000000..6dab5c0d0 --- /dev/null +++ b/assets/layers/shelter/license_info.json @@ -0,0 +1,12 @@ +[ + { + "path": "shelter.svg", + "license": "MIT", + "authors": [ + "Diemen Design" + ], + "sources": [ + "https://icon-icons.com/icon/map-shelter/158301" + ] + } +] \ No newline at end of file diff --git a/assets/layers/shelter/shelter.json b/assets/layers/shelter/shelter.json new file mode 100644 index 000000000..803b6ef42 --- /dev/null +++ b/assets/layers/shelter/shelter.json @@ -0,0 +1,88 @@ +{ + "id": "shelter", + "name": { + "en": "Shelter" + }, + "description": { + "en": "Layer showing shelter structures" + }, + "source": { + "osmTags": { + "and": [ + "amenity=shelter" + ] + } + }, + "minzoom": 13, + "title": { + "render": { + "en": "Shelter" + } + }, + "mapRendering": [ + { + "location": [ + "point", + "centroid" + ], + "icon": "./assets/layers/shelter/shelter.svg" + } + ], + "tagRenderings": [ + { + "id": "shelter-type", + "mappings": [ + { + "if": "shelter_type=public_transport", + "then": { + "en": "This is a shelter at a public transport stop." + } + }, + { + "if": "shelter_type=picnic_shelter", + "then": { + "en": "This is a shelter protecting from rain at a picnic site." + } + }, + { + "if": "shelter_type=gazebo", + "then": { + "en": "This is a gazebo." + } + }, + { + "if": "shelter_type=weather_shelter", + "then": { + "en": "This is a small shelter, primarily intended for short breaks. Usually found in the mountains or alongside roads." + } + }, + { + "if": "shelter_type=lean_to", + "then": { + "en": "This is a shed with 3 walls, primarily intended for camping." + } + }, + { + "if": "shelter_type=pavilion", + "then": { + "en": "This is a pavilion" + } + }, + { + "if": "shelter_type=basic_hut", + "then": "This is a basic hut, providing basic shelter and sleeping facilities." + } + ], + "question": { + "en": "What kind of shelter is this?" + }, + "render": { + "en": "Shelter type: {shelter_type}" + }, + "freeform": { + "key": "shelter_type", + "type": "string" + } + } + ] +} \ No newline at end of file diff --git a/assets/layers/shelter/shelter.svg b/assets/layers/shelter/shelter.svg new file mode 100644 index 000000000..266a9eb7c --- /dev/null +++ b/assets/layers/shelter/shelter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/layers/shops/shops.json b/assets/layers/shops/shops.json index 9f5a32dce..401fd0c01 100644 --- a/assets/layers/shops/shops.json +++ b/assets/layers/shops/shops.json @@ -412,29 +412,37 @@ "filter": [ { "id": "shop-type", - "options": [{ - "fields": [{ - "name": "search", - "type": "string" - }], - "osmTags": "shop~^.*{search}.*$", - "question": { - "en": "Only show shops selling {search}" + "options": [ + { + "fields": [ + { + "name": "search", + "type": "string" + } + ], + "osmTags": "shop~^.*{search}.*$", + "question": { + "en": "Only show shops selling {search}" + } } - } ] }, { "id": "shop-name", - "options": [{ - "fields": [{ - "name": "search", - "type": "string" - }], - "osmTags": "name~^.*{search}.*$", - "question": { - "en": "Only show shops with name {search}" + "options": [ + { + "fields": [ + { + "name": "search", + "type": "string" + } + ], + "osmTags": "name~^.*{search}.*$", + "question": { + "en": "Only show shops with name {search}" + } } - }]} + ] + } ] } \ No newline at end of file diff --git a/assets/layers/transit_routes/transit_routes.json b/assets/layers/transit_routes/transit_routes.json new file mode 100644 index 000000000..b29464746 --- /dev/null +++ b/assets/layers/transit_routes/transit_routes.json @@ -0,0 +1,141 @@ +{ + "id": "transit_routes", + "name": { + "en": "Bus lines" + }, + "description": { + "en": "Layer showing bus lines" + }, + "source": { + "osmTags": { + "and": [ + "type=route", + "route=bus" + ] + } + }, + "minzoom": 15, + "title": { + "render": { + "en": "Bus line" + }, + "mappings": [ + { + "if": "name~*", + "then": { + "en": "{name}" + } + } + ] + }, + "mapRendering": [ + { + "color": { + "render": { + "en": "#ff0000" + }, + "mappings": [ + { + "if": "colour~*", + "then": "{colour}" + } + ] + } + } + ], + "tagRenderings": [ + { + "id": "name", + "freeform": { + "key": "name", + "type": "string", + "placeholder": "Bus XX: From => Via => To" + }, + "render": "{name}", + "question": { + "en": "What is the name for this bus line? (i.e. Bus XX: From => Via => To)" + } + }, + { + "id": "from", + "freeform": { + "key": "from", + "type": "string", + "placeholder": "City, Stop Name" + }, + "render": { + "en": "This bus line begins at {from}" + }, + "question": { + "en": "What is the starting point for this bus line?" + } + }, + { + "id": "via", + "freeform": { + "key": "via", + "type": "string", + "placeholder": "City, Stop Name" + }, + "render": { + "en": "This bus line goes via {via}" + }, + "question": { + "en": "What is the via point for this bus line?" + } + }, + { + "id": "to", + "freeform": { + "key": "to", + "type": "string", + "placeholder": "City, Stop Name" + }, + "render": { + "en": "This bus line ends at {to}" + }, + "question": { + "en": "What is the ending point for this bus line?" + } + }, + { + "id": "colour", + "freeform": { + "key": "colour", + "type": "color" + }, + "render": { + "en": "This bus line has the color {colour}" + }, + "question": { + "en": "What is the colour for this bus line?" + } + }, + { + "id": "network", + "freeform": { + "key": "network", + "type": "string" + }, + "render": { + "en": "This bus line is part of the {network} network" + }, + "question": { + "en": "What network does this bus line belong to?" + } + }, + { + "id": "operator", + "freeform": { + "key": "operator", + "type": "string" + }, + "render": { + "en": "This bus line is operated by {operator}" + }, + "question": { + "en": "What company operates this bus line?" + } + } + ] +} \ No newline at end of file diff --git a/assets/layers/transit_stops/bus_stop.svg b/assets/layers/transit_stops/bus_stop.svg new file mode 100644 index 000000000..1b061c00b --- /dev/null +++ b/assets/layers/transit_stops/bus_stop.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/layers/transit_stops/license_info.json b/assets/layers/transit_stops/license_info.json new file mode 100644 index 000000000..47a736deb --- /dev/null +++ b/assets/layers/transit_stops/license_info.json @@ -0,0 +1,15 @@ +[ + { + "path": "bus_stop.svg", + "license": "CC0", + "authors": [ + "Andy Allan", + "Michael Glanznig", + "Paul Norman", + "Paul Dicker" + ], + "sources": [ + "https://github.com/gravitystorm/openstreetmap-carto/blob/master/symbols/highway/bus_stop.svg" + ] + } +] \ No newline at end of file diff --git a/assets/layers/transit_stops/transit_stops.json b/assets/layers/transit_stops/transit_stops.json new file mode 100644 index 000000000..43daa2ada --- /dev/null +++ b/assets/layers/transit_stops/transit_stops.json @@ -0,0 +1,260 @@ +{ + "id": "transit_stops", + "name": { + "en": "Transit Stops" + }, + "description": { + "en": "Layer showing different types of transit stops." + }, + "source": { + "osmTags": { + "or": [ + "highway=bus_stop" + ] + } + }, + "minzoom": 15, + "title": { + "render": { + "en": "Transit Stop" + }, + "mappings": [ + { + "if": "name~*", + "then": { + "en": "Stop {name}" + } + } + ] + }, + "mapRendering": [ + { + "location": [ + "point", + "centroid" + ], + "icon": { + "render": "./assets/layers/transit_stops/bus_stop.svg", + "mappings": [] + }, + "label": "
{name}
" + } + ], + "calculatedTags": [ + "_routes=feat.memberships()", + "_contained_routes_properties=feat.memberships().map(p => {return {id: p.relation.id, name: p.relation.properties.name} }).filter((v,i,a)=>a.findIndex(t=>(JSON.stringify(t) === JSON.stringify(v)))===i)", + "_contained_route_ids=JSON.parse(feat.properties._contained_routes_properties ?? '[]').map(p => p.id)", + "_contained_routes=JSON.parse(feat.properties._contained_routes_properties ?? '[]').map(p => `
  • ${p.name ?? 'bus route'}
  • `).join('')", + "_contained_routes_count=JSON.parse(feat.properties._contained_routes_properties ?? '[]').length" + ], + "tagRenderings": [ + { + "id": "stop_name", + "render": { + "en": "This stop is called {name}" + }, + "freeform": { + "key": "name", + "type": "string", + "addExtraTags": [ + "noname=" + ], + "placeholder": { + "en": "Name of the stop" + } + }, + "mappings": [ + { + "if": { + "and": [ + "noname=yes", + "name=" + ] + }, + "then": { + "en": "This stop has no name" + } + } + ], + "question": { + "en": "What is the name of this stop?" + }, + "placeholder": "Name of the stop" + }, + "images", + { + "id": "shelter", + "mappings": [ + { + "if": "shelter=yes", + "then": { + "en": "This stop has a shelter" + } + }, + { + "if": "shelter=no", + "then": { + "en": "This stop does not have a shelter" + } + }, + { + "if": "shelter=separate", + "then": { + "en": "This stop has a shelter, that's separately mapped" + }, + "hideInAnswer": true + } + ], + "question": { + "en": "Does this stop have a shelter?" + } + }, + { + "id": "bench", + "mappings": [ + { + "if": "bench=yes", + "then": { + "en": "This stop has a bench" + } + }, + { + "if": "bench=no", + "then": { + "en": "This stop does not have a bench" + } + }, + { + "if": "bench=separate", + "then": { + "en": "This stop has a bench, that's separately mapped" + }, + "hideInAnswer": true + } + ], + "question": { + "en": "Does this stop have a bench?" + } + }, + { + "id": "bin", + "mappings": [ + { + "if": "bin=yes", + "then": { + "en": "This stop has a bin" + } + }, + { + "if": "bin=no", + "then": { + "en": "This stop does not have a bin" + } + }, + { + "if": "bin=separate", + "then": { + "en": "This stop has a bin, that's separately mapped" + }, + "hideInAnswer": true + } + ], + "question": { + "en": "Does this stop have a bin?" + } + }, + "wheelchair-access", + { + "id": "tactile_paving", + "mappings": [ + { + "if": "tactile_paving=yes", + "then": { + "en": "This stop has tactile paving" + } + }, + { + "if": "tactile_paving=no", + "then": { + "en": "This stop does not have tactile paving" + } + } + ], + "question": { + "en": "Does this stop have tactile paving?" + } + }, + { + "id": "lit", + "mappings": [ + { + "if": "lit=yes", + "then": { + "en": "This stop is lit" + } + }, + { + "if": "lit=no", + "then": { + "en": "This stop is not lit" + } + } + ], + "question": { + "en": "Is this stop lit?" + } + }, + { + "id": "departures_board", + "mappings": [ + { + "if": "departures_board=yes", + "then": { + "en": "This stop has a departures board of unknown type" + }, + "hideInAnswer": true + }, + { + "if": "departures_board=realtime", + "then": { + "en": "This stop has a board showing realtime departure information" + } + }, + { + "if": "passenger_information_display=yes", + "then": { + "en": "This stop has a board showing realtime departure information" + }, + "hideInAnswer": true + }, + { + "if": "departures_board=timetable", + "then": { + "en": "This stop has a timetable showing regular departures" + } + }, + { + "if": "departures_board=interval", + "then": { + "en": "This stop has a timetable containing just the interval between departures" + } + }, + { + "if": "departures_board=no", + "then": { + "en": "This stop does not have a departures board" + } + } + ] + }, + { + "render": { + "en": "

    {_contained_routes_count} routes stop at this stop

    " + }, + "condition": "_contained_routes~*", + "id": "contained_routes" + } + ], + "filter": [], + "allowMove": false +} \ No newline at end of file diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index b03b39e7a..bb65497b7 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -231,10 +231,6 @@ "if": "theme=openwindpowermap", "then": "./assets/themes/openwindpowermap/logo.svg" }, - { - "if": "theme=parking-lanes", - "then": "./assets/svg/bug.svg" - }, { "if": "theme=parkings", "then": "./assets/themes/parkings/parkings.svg" @@ -295,6 +291,10 @@ "if": "theme=toilets", "then": "./assets/themes/toilets/toilets.svg" }, + { + "if": "theme=transit", + "then": "./assets/layers/transit_stops/bus_stop.svg" + }, { "if": "theme=trees", "then": "./assets/themes/trees/logo.svg" diff --git a/assets/themes/transit/transit.json b/assets/themes/transit/transit.json new file mode 100644 index 000000000..271510c2f --- /dev/null +++ b/assets/themes/transit/transit.json @@ -0,0 +1,51 @@ +{ + "id": "transit", + "maintainer": "Robin van der Linde", + "version": "20220406", + "title": { + "en": "Bus routes" + }, + "description": { + "en": "Plan your trip with the help of the public transport system." + }, + "icon": "./assets/layers/transit_stops/bus_stop.svg", + "startZoom": 20, + "startLat": 53.21333, + "startLon": 6.56963, + "layers": [ + "transit_stops", + "transit_routes", + { + "builtin": "bike_parking", + "override": { + "minzoom": 19, + "minzoomVisible": 19 + } + }, + { + "builtin": "parking", + "override": { + "minzoom": 19, + "minzoomVisible": 19 + } + }, + { + "builtin": "shelter", + "override": { + "minzoom": 19, + "minzoomVisible": 19, + "source": { + "osmTags": { + "and": [ + "amenity=shelter", + "shelter_type=public_transport" + ] + } + } + }, + "hideTagRenderingsWithLabels": [ + "shelter-type" + ] + } + ] +} \ No newline at end of file diff --git a/langs/layers/en.json b/langs/layers/en.json index ddeee9e6f..dd0c9fc87 100644 --- a/langs/layers/en.json +++ b/langs/layers/en.json @@ -4400,6 +4400,39 @@ "render": "Recycling facility" } }, + "shelter": { + "description": "Layer showing shelter structures", + "name": "Shelter", + "tagRenderings": { + "shelter-type": { + "mappings": { + "0": { + "then": "This is a shelter at a public transport stop." + }, + "1": { + "then": "This is a shelter protecting from rain at a picnic site." + }, + "2": { + "then": "This is a gazebo." + }, + "3": { + "then": "This is a small shelter, primarily intended for short breaks. Usually found in the mountains or alongside roads." + }, + "4": { + "then": "This is a shed with 3 walls, primarily intended for camping." + }, + "5": { + "then": "This is a pavilion" + } + }, + "question": "What kind of shelter is this?", + "render": "Shelter type: {shelter_type}" + } + }, + "title": { + "render": "Shelter" + } + }, "shops": { "deletion": { "extraDeleteReasons": { @@ -4409,6 +4442,22 @@ } }, "description": "A shop", + "filter": { + "0": { + "options": { + "0": { + "question": "Only show shops selling {search}" + } + } + }, + "1": { + "options": { + "0": { + "question": "Only show shops with name {search}" + } + } + } + }, "name": "Shop", "presets": { "0": { @@ -5082,6 +5131,140 @@ "render": "Trail" } }, + "transit_routes": { + "description": "Layer showing bus lines", + "mapRendering": { + "0": { + "color": { + "render": "#ff0000" + } + } + }, + "name": "Bus lines", + "title": { + "mappings": { + "0": { + "then": "{name}" + } + }, + "render": "Bus line" + } + }, + "transit_stops": { + "description": "Layer showing different types of transit stops.", + "name": "Transit Stops", + "tagRenderings": { + "bench": { + "mappings": { + "0": { + "then": "This stop has a bench" + }, + "1": { + "then": "This stop does not have a bench" + }, + "2": { + "then": "This stop has a bench, that's separately mapped" + } + }, + "question": "Does this stop have a bench?" + }, + "bin": { + "mappings": { + "0": { + "then": "This stop has a bin" + }, + "1": { + "then": "This stop does not have a bin" + }, + "2": { + "then": "This stop has a bin, that's separately mapped" + } + }, + "question": "Does this stop have a bin?" + }, + "contained_routes": { + "render": "

    {_contained_routes_count} routes stop at this stop

    " + }, + "departures_board": { + "mappings": { + "0": { + "then": "This stop has a departures board of unknown type" + }, + "1": { + "then": "This stop has a board showing realtime departure information" + }, + "2": { + "then": "This stop has a board showing realtime departure information" + }, + "3": { + "then": "This stop has a timetable showing regular departures" + }, + "4": { + "then": "This stop has a timetable containing just the interval between departures" + }, + "5": { + "then": "This stop does not have a departures board" + } + } + }, + "lit": { + "mappings": { + "0": { + "then": "This stop is lit" + }, + "1": { + "then": "This stop is not lit" + } + }, + "question": "Is this stop lit?" + }, + "shelter": { + "mappings": { + "0": { + "then": "This stop has a shelter" + }, + "1": { + "then": "This stop does not have a shelter" + }, + "2": { + "then": "This stop has a shelter, that's separately mapped" + } + }, + "question": "Does this stop have a shelter?" + }, + "stop_name": { + "freeform": { + "placeholder": "Name of the stop" + }, + "mappings": { + "0": { + "then": "This stop has no name" + } + }, + "question": "What is the name of this stop?", + "render": "This stop is called {name}" + }, + "tactile_paving": { + "mappings": { + "0": { + "then": "This stop has tactile paving" + }, + "1": { + "then": "This stop does not have tactile paving" + } + }, + "question": "Does this stop have tactile paving?" + } + }, + "title": { + "mappings": { + "0": { + "then": "Stop {name}" + } + }, + "render": "Transit Stop" + } + }, "tree_node": { "description": "A layer showing trees", "name": "Tree", diff --git a/langs/themes/en.json b/langs/themes/en.json index 80a08d43f..cd6a854a6 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -1312,6 +1312,10 @@ "description": "A map of public toilets", "title": "Open Toilet Map" }, + "transit": { + "description": "Transit", + "title": "Transit" + }, "trees": { "description": "Map all the trees!", "shortDescription": "Map all the trees",