From 3d2ca156f42839047791f118b084228321399c9f Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Fri, 23 Oct 2020 11:49:39 +0200 Subject: [PATCH 1/2] Add benches theme --- Customizations/AllKnownLayouts.ts | 2 + README.md | 5 +- assets/themes/benches/bench_poi.svg | 16 ++ .../themes/benches/bench_public_transport.svg | 16 ++ assets/themes/benches/benches.json | 248 ++++++++++++++++++ 5 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 assets/themes/benches/bench_poi.svg create mode 100644 assets/themes/benches/bench_public_transport.svg create mode 100644 assets/themes/benches/benches.json diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index a660137..e95ece6 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -14,6 +14,7 @@ import * as maps from "../assets/themes/maps/maps.json" import * as shops from "../assets/themes/shops/shops.json" import * as bike_monitoring_stations from "../assets/themes/bike_monitoring_station/bike_monitoring_stations.json" import * as fritures from "../assets/themes/fritures/fritures.json" +import * as benches from "../assets/themes/benches/benches.json"; import {PersonalLayout} from "../Logic/PersonalLayout"; import {StreetWidth} from "./StreetWidth/StreetWidth"; @@ -68,6 +69,7 @@ export class AllKnownLayouts { FromJSON.LayoutFromJSON(cyclestreets), FromJSON.LayoutFromJSON(maps), FromJSON.LayoutFromJSON(fritures), + FromJSON.LayoutFromJSON(benches), AllKnownLayouts.GenerateBuurtNatuur(), AllKnownLayouts.GenerateBikeMonitoringStations(), diff --git a/README.md b/README.md index da1f2d6..c4b5e0b 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,6 @@ Bicycle logo, Scott de Jonge Nature Reserve icon via http://www.onlinewebfonts.com/icon/389579, CC BY 3.0 (@ Эдуард Черных) - Park icon via http://www.onlinewebfonts.com/icon/425974, CC BY 3.0 (@sterankofrank) Forest icon via https://www.onlinewebfonts.com/icon/498112, CC BY @@ -207,4 +206,6 @@ Forest icon via https://www.onlinewebfonts.com/icon/498112, CC BY Statistics icon via https://www.onlinewebfonts.com/icon/197818 Chronometer (on monitoring_station.svg): ANTU chronometer -https://commons.wikimedia.org/w/index.php?title=Antu_chronometer&action=edit&redlink=1 \ No newline at end of file +https://commons.wikimedia.org/w/index.php?title=Antu_chronometer&action=edit&redlink=1 + +Bench icons from StreetComplete: https://github.com/westnordost/StreetComplete/tree/v25.0-beta1/res/graphics/quest%20icons, GPLv3.0 diff --git a/assets/themes/benches/bench_poi.svg b/assets/themes/benches/bench_poi.svg new file mode 100644 index 0000000..8dfd478 --- /dev/null +++ b/assets/themes/benches/bench_poi.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/themes/benches/bench_public_transport.svg b/assets/themes/benches/bench_public_transport.svg new file mode 100644 index 0000000..808ff9e --- /dev/null +++ b/assets/themes/benches/bench_public_transport.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/themes/benches/benches.json b/assets/themes/benches/benches.json new file mode 100644 index 0000000..69356bb --- /dev/null +++ b/assets/themes/benches/benches.json @@ -0,0 +1,248 @@ +{ + "id": "benches", + "title": { + "en": "Benches", + "de": "Sitzbänke" + }, + "shortDescription": { + "en": "A map of benches", + "de": "Eine Karte aller Sitzbänke" + }, + "description": { + "en": "This map shows all benches that are recorded in OpenStreetMap: Individual benches, and benches belonging to public transport stops or shelters. With an OpenStreetMap account, you can map new benches or edit details of existing benches.", + "de": "Diese Karte zeigt alle Sitzbänke, die in OpenStreetMap eingetragen sind: Einzeln stehende Bänke und Bänke, die zu Haltestellen oder Unterständen gehören. Mit einem OpenStreetMap-Account können Sie neue Bänke eintragen oder Detailinformationen existierender Bänke bearbeiten." + }, + "language": [ + "en", + "de" + ], + "maintainer": "Florian Edelmann", + "icon": "./assets/themes/benches/bench_poi.svg", + "version": "2020-10-23", + "startLat": 0, + "startLon": 0, + "startZoom": 12, + "widenFactor": 0.05, + "socialImage": "", + "layers": [ + { + "id": "amenity=bench", + "name": { + "en": "Benches", + "de": "Sitzbänke" + }, + "minzoom": 14, + "overpassTags": { + "and": [ + "amenity=bench" + ] + }, + "title": { + "render": { + "en": "Bench", + "de": "Sitzbank" + }, + "mappings": [] + }, + "description": {}, + "tagRenderings": [ + { + "render": { + "en": "Backrest", + "de": "Rückenlehne" + }, + "freeform": { + "key": "backrest", + "addExtraTags": [] + }, + "mappings": [ + { + "if": { + "and": [ + "backrest=yes" + ] + }, + "then": { + "en": "Backrest: Yes", + "de": "Rückenlehne: Ja" + } + }, + { + "if": { + "and": [ + "backrest=no" + ] + }, + "then": { + "en": "Backrest: No", + "de": "Rückenlehne: Nein" + } + } + ], + "question": { + "en": "Does this bench have a backrest?", + "de": "Hat diese Bank eine Rückenlehne?" + } + }, + { + "render": { + "en": "{seats} seats", + "de": "{seats} Sitzplätze" + }, + "freeform": { + "key": "seats", + "type": "nat" + }, + "mappings": [], + "question": { + "en": "How many seats does this bench have?", + "de": "Wie viele Sitzplätze hat diese Bank?" + } + }, + { + "render": { + "en": "Material: {material}", + "de": "Material: {material}" + }, + "freeform": { + "key": "material", + "addExtraTags": [] + }, + "question": { + "en": "What is the bench (seating) made from?", + "de": "Aus welchem Material besteht die Sitzbank (Sitzfläche)?" + } + }, + { + "render": { + "en": "Color: {colour}", + "de": "Farbe: {colour}" + }, + "question": { + "en": "Which color does this bench have?", + "de": "Welche Farbe hat diese Sitzbank?" + }, + "freeform": { + "key": "colour" + } + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "./assets/themes/benches/bench_poi.svg", + "mappings": [] + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "20,20,center" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "amenity=bench" + ], + "title": { + "en": "Bench", + "de": "Sitzbank" + }, + "description": { + "en": "Add a new bench", + "de": "Neue Sitzbank eintragen" + } + } + ] + }, + { + "id": "bench=yes", + "name": { + "en": "Benches at public transport stops", + "de": "Sitzbänke bei Haltestellen" + }, + "minzoom": 14, + "overpassTags": { + "or": [ + "bench=yes", + "bench=stand_up_bench" + ] + }, + "title": { + "render": { + "en": "Bench", + "de": "Sitzbank" + }, + "mappings": [ + { + "if": { + "or": [ + "public_transport=platform", + "railway=platform", + "highway=bus_stop" + ] + }, + "then": { + "en": "Bench at public transport stop", + "de": "Sitzbank bei Haltestelle" + } + }, + { + "if": { + "and": [ + "amenity=shelter" + ] + }, + "then": { + "en": "Bench in shelter", + "de": "Sitzbank in Unterstand" + } + } + ] + }, + "description": {}, + "tagRenderings": [ + { + "render": { + "en": "{name}", + "de": "{name}" + }, + "freeform": { + "key": "name" + } + }, + { + "render": { + "en": "Stand up bench", + "de": "Stehbank" + }, + "freeform": { + "key": "bench", + "addExtraTags": [] + }, + "condition": { + "and": [ + "bench=stand_up_bench" + ] + } + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "./assets/themes/benches/bench_public_transport.svg" + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "20,20,center" + }, + "color": { + "render": "#00f" + } + } + ], + "roamingRenderings": [] +} From 065453338bcb35073995b34d0fdb3ba297787e82 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Fri, 23 Oct 2020 12:07:52 +0200 Subject: [PATCH 2/2] Improve README.md --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c4b5e0b..d74b597 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ A typical user journey would be: * Note that _all messages_ must be read before being able to add a point. * In other words, sending a message to a misbehaving MapComplete user acts as having a **zero-day-block**. This is added deliberately to make sure new users _have_ to read feedback from the community. -4. At 50 changesets, the [personal layout](https://pietervdvn.github.io/MapComplete/personal.html) is advertised. The personal theme is a theme where contributors can pick layers from all the offical themes. Note that the personal theme is always available. +4. At 50 changesets, the [personal layout](https://pietervdvn.github.io/MapComplete/personal.html) is advertised. The personal theme is a theme where contributors can pick layers from all the offical themes. Note that the personal theme is always available. 5. At 200 changesets, the tags become visible when answering questions and when adding a new point from a preset. This is to give more control to power users and to teach new users the tagging scheme @@ -83,9 +83,9 @@ To develop: 0. Make a fork and clone the repository. -1. Install `npm`. Linux: `sudo apt install npm` (or your favourite package manager), windows: install nodeJS: https://nodejs.org/en/download/ +1. Install `npm`. Linux: `sudo apt install npm` (or your favourite package manager), Windows: install nodeJS: https://nodejs.org/en/download/ 2. Run `npm install` to install the dependencies -3. Run `npm run start` to build and host a local testversion +3. Run `npm run start` to build and host a local testversion at http://localhost:1234/index.html 4. By default, the 'bookcases'-theme is loaded. In order to load another theme, use `layout=themename` or `userlayout=true#`. Note that the custom URLs (e.g. `bookcases.html`, `aed.html`, ...) _don't_ exist on the development version. (These are automatically generated from a template on the server). To deploy: @@ -101,8 +101,8 @@ Help to translate mapcomplete. A theme has translations into the preset.json (`assets/themes/themename/themename.json`). To add a translation: -1. Modify `"language"` to contain the new language, e.g. `"language":"nl"` becomes `"language": ["nl", "en"]` -2. Add extra strings to the texts. If it used to be a single-language theme, one can replace the strings, e.g.: `"description":"Welcome to Open Bookcase Map"` to `"description": {"en":"Welcome to Open Bookcase Map", "nl": "Welkom bij de OpenBoekenruilkastenKaart", "fr": "Bienvenue sûr la carte des petites bibliotheques"}`. If the correct language is not found, it'll fallback to antoher supported language. +1. Modify `"language"` to contain the new language, e.g. `"language": "nl"` becomes `"language": ["nl", "en"]` +2. Add extra strings to the texts. If it used to be a single-language theme, one can replace the strings, e.g.: `"description": "Welcome to Open Bookcase Map"` to `"description": {"en": "Welcome to Open Bookcase Map", "nl": "Welkom bij de OpenBoekenruilkastenKaart", "fr": "Bienvenue sûr la carte des petites bibliotheques"}`. If the correct language is not found, it'll fallback to another supported language. 3. If you notice missing translations in the core of MapComplete, fork this project, open [the file containing all translations](https://github.com/pietervdvn/MapComplete/blob/master/UI/i18n/Translations.ts), add add a language string there 4. Send a pull request to update the languages, I'll gladly add it! It doesn't have to be a complete translation from the start ;) @@ -112,19 +112,19 @@ Did you make an awesome theme that you want to share with the OpenStreetMap comm In order to include your theme: -0) Make sure the theme has an english version. This makes it easier for me to understand what is going on. The more other languages, the better of course! +0) Make sure the theme has an English version. This makes it easier for me to understand what is going on. The more other languages, the better of course! 1) Fork this repository 2) Go to `assets/themes` and create a new directory `yourtheme` -3) Create a new file `yourtheme.json`, paste the theme configuration in there. You can find your theme configuration in the customThemeBuilder (the tab with the Floppy) -4) Copy all the images in this new directory: external assets can suddenly break and leak privacy +3) Create a new file `yourtheme.json`, paste the theme configuration in there. You can find your theme configuration in the customThemeBuilder (the tab with the *Floppy disk* icon) +4) Copy all the images into this new directory: external assets can suddenly break and leak privacy - Make sure the license is suitable, preferable a Creative Commons license. Attribution can be added at the bottom of this document - - If an SVG-version is available, use the SVG-version - - Make sure all the links in `yourtheme.json` are updated. You can use `"./assets/themes/yourtheme/yourimage.svg" instead of the HTML link + - If an SVG version is available, use the SVG version + - Make sure all the links in `yourtheme.json` are updated. You can use `./assets/themes/yourtheme/yourimage.svg` instead of the HTML link 5) Add your theme to the code base: - Open [AllKnownLayouts.ts](https://github.com/pietervdvn/MapComplete/blob/master/Customizations/AllKnownLayouts.ts) - - Add an import statatement, e.g. `import * as fritures from "../assets/themes/yourtheme/yourthemes.json" - - Add your theme to the `LayoutList`, by adding a line `FromJSON.LayoutFromJSON(maps)` - 6) Test your theme: run the project as described above + - Add an import statatement, e.g. `import * as yourtheme from "../assets/themes/yourtheme/yourthemes.json";` + - Add your theme to the `LayoutList`, by adding a line `FromJSON.LayoutFromJSON(yourtheme)` + 6) Test your theme: run the project as described [above](#Dev) 7) Happy with your theme? Time to open a Pull Request! 8) Thanks a lot for improving MapComplete!