Merge pull request #1201 from tordans/crossing-refactoring

Crossing refactoring
This commit is contained in:
Martin Raifer 2024-11-13 12:46:17 +01:00 committed by GitHub
commit a090dadf41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 454 additions and 133 deletions

View file

@ -7,12 +7,12 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: |
notJSONs=`find data/ -type f -not -iname "*.json"`
for f in $notJSONs
disallowedFiles=`find data/ -type f -not -iname "*.json" -not -iname "*.md"`
for f in $disallowedFiles
do
echo "::error file=$f::File $f is not a .json file."
echo "::error file=$f::File $f is not a .json or .md file."
done
if [ ! -z "$notJSONs" ]; then exit 1; fi
if [ ! -z "$disallowedFiles" ]; then exit 1; fi
prettier:
name: Check for code formatting mistakes
@ -23,7 +23,6 @@ jobs:
with:
node-version-file: '.nvmrc'
- run: npm clean-install
- run: 'for f in `find data/ -type f -not -iname "*.json"`; do echo "::error File $f is not a .json file."; done'
- run: npm run lint
codespell:
@ -37,4 +36,3 @@ jobs:
skip: ./.git,./dist,./data/deprecated.json,./data/discarded.json
ignore_words_list: "auxilary,casette,cemetary,chancel,discus,extentions,faiway,generat,goverment,guerilla,guyser,kindergarden,ore,pavillion,sculpter,storys,linz,te"
only_warn: 1

View file

@ -2,6 +2,7 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"autoSuggestions": false,
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"options": [
@ -15,6 +16,5 @@
"include": [
"BG"
]
},
"autoSuggestions": false
}
}

View file

@ -2,6 +2,9 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"autoSuggestions": false,
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"options": [
"zebra",
"yes",
@ -10,9 +13,6 @@
"dashes",
"surface"
],
"autoSuggestions": false,
"iconsCrossReference": "{crossing/markings}",
"stringsCrossReference": "{crossing/markings}",
"locationSet": {
"include": [
"DE",

View file

@ -2,6 +2,9 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"autoSuggestions": false,
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"options": [
"zebra",
"dots",
@ -9,9 +12,6 @@
"yes",
"no"
],
"autoSuggestions": false,
"iconsCrossReference": "{crossing/markings}",
"stringsCrossReference": "{crossing/markings}",
"locationSet": {
"include": [
"PL"

View file

@ -2,9 +2,10 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"autoSuggestions": false,
"default": "yes",
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"default": "yes",
"options": [
"zebra",
"no",
@ -16,6 +17,5 @@
"include": [
"BG"
]
},
"autoSuggestions": false
}
}

View file

@ -2,6 +2,10 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"autoSuggestions": false,
"default": "yes",
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"options": [
"zebra",
"yes",
@ -10,15 +14,11 @@
"dashes",
"surface"
],
"autoSuggestions": false,
"iconsCrossReference": "{crossing/markings}",
"stringsCrossReference": "{crossing/markings}",
"locationSet": {
"include": [
"DE",
"AT",
"CH"
]
},
"default": "yes"
}
}

View file

@ -2,6 +2,10 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"autoSuggestions": false,
"default": "yes",
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"options": [
"zebra",
"dots",
@ -9,13 +13,9 @@
"yes",
"no"
],
"autoSuggestions": false,
"iconsCrossReference": "{crossing/markings}",
"stringsCrossReference": "{crossing/markings}",
"locationSet": {
"include": [
"PL"
]
},
"default": "yes"
}
}

View file

@ -2,9 +2,9 @@
"key": "crossing:markings",
"type": "combo",
"label": "{crossing/markings}",
"default": "yes",
"stringsCrossReference": "{crossing/markings}",
"iconsCrossReference": "{crossing/markings}",
"default": "yes",
"locationSet": {
"exclude": [
"BG",

View file

@ -0,0 +1,13 @@
# About `@templates`
Presets in `@templates` are a convention for a _virtual_ presets that are only used from inside other presets.
The only property that really matter for these special presets are the `fields`.
All other properties can be copied from existing template presets and ignored. They are default values that are meant to match all cases where they might be referenced.
## How to use
Inside another preset, reference the template or any other preset - like `"{@templates/internet_access}"` in `fields` or `moreFields`. This will "copy" all the listed fields from the file `data/presets/@templates/internet_access.json`.
You can only "copy" (template) `fields` to (preset) `fields` and (template) `moreFields` to (preset) `moreFields`.

View file

@ -0,0 +1,23 @@
{
"moreFields": [
"oneway",
"access",
"segregated"
],
"geometry": [
"line"
],
"tags": {
"@template": "crossing/bicycle_more"
},
"searchable": false,
"locationSet": {
"include": [
"999"
],
"exclude": [
"999"
]
},
"name": "{point}"
}

View file

@ -0,0 +1,23 @@
{
"fields": [
"crossing/island",
"crossing_raised"
],
"geometry": [
"point",
"line"
],
"tags": {
"@template": "crossing/defaults"
},
"searchable": false,
"locationSet": {
"include": [
"999"
],
"exclude": [
"999"
]
},
"name": "{point}"
}

View file

@ -0,0 +1,22 @@
{
"moreFields": [
"smoothness",
"lit"
],
"geometry": [
"line"
],
"tags": {
"@template": "crossing/geometry_way_more"
},
"searchable": false,
"locationSet": {
"include": [
"999"
],
"exclude": [
"999"
]
},
"name": "{point}"
}

View file

@ -6,7 +6,8 @@
"crossing/markings-PL"
],
"geometry": [
"point"
"point",
"line"
],
"tags": {
"@template": "crossing/markings"

View file

@ -6,7 +6,8 @@
"crossing/markings_yes-PL"
],
"geometry": [
"point"
"point",
"line"
],
"tags": {
"@template": "crossing/markings_yes"

View file

@ -0,0 +1,22 @@
{
"fields": [
"surface",
"smoothness"
],
"geometry": [
"line"
],
"tags": {
"@template": "crossing/surfacequality"
},
"searchable": false,
"locationSet": {
"include": [
"999"
],
"exclude": [
"999"
]
},
"name": "{point}"
}

View file

@ -0,0 +1,24 @@
{
"fields": [
"button_operated",
"traffic_signals/sound",
"traffic_signals/vibration"
],
"geometry": [
"point",
"line"
],
"tags": {
"@template": "crossing/traffic_signal"
},
"searchable": false,
"locationSet": {
"include": [
"999"
],
"exclude": [
"999"
]
},
"name": "{point}"
}

View file

@ -0,0 +1,24 @@
{
"moreFields": [
"traffic_signals/arrow",
"traffic_signals/countdown",
"traffic_signals/minimap"
],
"geometry": [
"point",
"line"
],
"tags": {
"@template": "crossing/traffic_signal_more"
},
"searchable": false,
"locationSet": {
"include": [
"999"
],
"exclude": [
"999"
]
},
"name": "{point}"
}

View file

@ -1,15 +1,13 @@
{
"fields": [
"crossing",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised"
"{@templates/crossing/defaults}",
"tactile_paving"
],
"moreFields": [
"flashing_lights",
"kerb",
"oneway"
"flashing_lights"
],
"geometry": [
"vertex"

View file

@ -0,0 +1,25 @@
# About the crossing presets
## General
These presets use fields `@templates` to make sure all have a similar structure.
Some presets like `traffic_signals` have additional fields and use a different field order.
Try to keep the file structure very similar so they can be easily compared.
## nodes `highway=crossing + crossing=*`
Crossing nodes are handled by `highway/crossing.json` and `highway/crossing/*.json` (as geometry type `vertex`).
Crossing nodes and crossing ways have a big overlap.
However, there are a few tags that should _only_ be expected on the crossing node. When crossing ways are present, this also means there are separate ways attached with additional nodes that may hold these additional tags.
There are places in OSM that follow a different tagging style where only crossing ways are used (without the vertex nodes). Those regions might use other conventions on where to place each tag.
## ways `highway=footway|cycleway|path + *=crossing + crossing=*`
Crossing way presets are duplicated per highway class:
- `/highway/footway/crossing.json` + `/highway/footway/crossing/*.json`
- `/highway/cycleway/crossing.json` + `/highway/cycleway/crossing/*.json`
- `/highway/path/crossing.json` + `/highway/path/crossing/*.json`
The crossing presets for `/cycleway*` and `/path*` are considered to be relevant for bike traffic and have additional fields that target bike vs. foot traffic.

View file

@ -2,10 +2,13 @@
"icon": "temaki-pedestrian_crosswalk",
"fields": [
"crossing",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised"
"{@templates/crossing/defaults}",
"tactile_paving"
],
"moreFields": [
"kerb",
"flashing_lights"
],
"geometry": [
"vertex"
@ -23,11 +26,6 @@
"key": "crossing",
"value": "marked"
},
"terms": [
"zebra crossing",
"marked crossing",
"crosswalk"
],
"name": "{highway/crossing/uncontrolled}",
"searchable": false
}

View file

@ -2,10 +2,13 @@
"icon": "temaki-pedestrian_crosswalk",
"fields": [
"crossing",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised"
"{@templates/crossing/defaults}",
"tactile_paving"
],
"moreFields": [
"kerb",
"flashing_lights"
],
"geometry": [
"vertex"

View file

@ -2,19 +2,15 @@
"icon": "temaki-railway_signals",
"fields": [
"crossing",
"tactile_paving",
"crossing/island",
"{@templates/crossing/traffic_signal}",
"{@templates/crossing/markings}",
"crossing_raised",
"button_operated",
"traffic_signals/sound",
"traffic_signals/vibration"
"{@templates/crossing/defaults}",
"tactile_paving"
],
"moreFields": [
"{@templates/crossing/traffic_signal_more}",
"kerb",
"traffic_signals/arrow",
"traffic_signals/countdown",
"traffic_signals/minimap"
"flashing_lights"
],
"geometry": [
"vertex"

View file

@ -2,10 +2,13 @@
"icon": "temaki-pedestrian_crosswalk",
"fields": [
"crossing",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings_yes}",
"crossing_raised"
"{@templates/crossing/defaults}",
"tactile_paving"
],
"moreFields": [
"kerb",
"flashing_lights"
],
"geometry": [
"vertex"

View file

@ -2,9 +2,12 @@
"icon": "temaki-pedestrian",
"fields": [
"crossing",
"tactile_paving",
"crossing/island",
"crossing_raised"
"{@templates/crossing/defaults}",
"tactile_paving"
],
"moreFields": [
"kerb",
"flashing_lights"
],
"geometry": [
"vertex"

View file

@ -2,11 +2,13 @@
"icon": "temaki-cyclist_crosswalk",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}"
],
"geometry": [
"line"

View file

@ -2,12 +2,13 @@
"icon": "temaki-cyclist_crosswalk",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}"
],
"geometry": [
"line"

View file

@ -11,13 +11,13 @@
"icon": "temaki-ped_cyclist_crosswalk",
"fields": [
"crossing",
"surface",
"smoothness",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}"
],
"geometry": [
"line"

View file

@ -1,19 +1,16 @@
{
"icon": "fas-biking",
"fields": [
"oneway",
"crossing",
"surface",
"crossing/island",
"{@templates/crossing/traffic_signal}",
"{@templates/crossing/markings}",
"crossing_raised",
"button_operated",
"traffic_signals/sound",
"traffic_signals/vibration",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"tactile_paving"
"{@templates/crossing/traffic_signal_more}",
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}"
],
"geometry": [
"line"

View file

@ -1,14 +1,14 @@
{
"icon": "temaki-cyclist_crosswalk",
"fields": [
"oneway",
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/defaults}",
"{@templates/crossing/markings_yes}",
"crossing_raised",
"access"
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}"
],
"geometry": [
"line"

View file

@ -2,11 +2,12 @@
"icon": "fas-biking",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}"
],
"geometry": [
"line"

View file

@ -1,14 +1,12 @@
{
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"flashing_lights"
],
"geometry": [

View file

@ -2,14 +2,12 @@
"icon": "temaki-pedestrian_crosswalk",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"flashing_lights"
],
"geometry": [

View file

@ -2,12 +2,13 @@
"icon": "temaki-pedestrian_crosswalk",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings}",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"flashing_lights"
],
"geometry": [
"line"

View file

@ -2,20 +2,15 @@
"icon": "temaki-railway_signals",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/traffic_signal}",
"{@templates/crossing/markings}",
"crossing_raised",
"button_operated",
"traffic_signals/sound",
"traffic_signals/vibration",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"traffic_signals/arrow",
"traffic_signals/countdown",
"traffic_signals/minimap"
"{@templates/crossing/traffic_signal_more}",
"{@templates/crossing/geometry_way_more}",
"flashing_lights"
],
"geometry": [
"line"

View file

@ -2,14 +2,12 @@
"icon": "temaki-pedestrian",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"{@templates/crossing/markings_yes}",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"flashing_lights"
],
"geometry": [

View file

@ -2,13 +2,11 @@
"icon": "temaki-pedestrian",
"fields": [
"crossing",
"surface",
"tactile_paving",
"crossing/island",
"crossing_raised",
"access"
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"flashing_lights"
],
"geometry": [

View file

@ -0,0 +1,30 @@
{
"icon": "temaki-cyclist_crosswalk",
"fields": [
"crossing",
"{@templates/crossing/markings}",
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}",
"flashing_lights"
],
"geometry": [
"line"
],
"tags": {
"path": "crossing"
},
"addTags": {
"highway": "path",
"path": "crossing"
},
"reference": {
"key": "path",
"value": "crossing"
},
"searchable": false,
"name": "Cycle & Foot Crossing"
}

View file

@ -0,0 +1,34 @@
{
"icon": "temaki-pedestrian_crosswalk",
"fields": [
"crossing",
"{@templates/crossing/markings}",
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}",
"flashing_lights"
],
"geometry": [
"line"
],
"tags": {
"highway": "path",
"path": "crossing",
"crossing": "marked"
},
"addTags": {
"highway": "path",
"path": "crossing",
"crossing": "marked",
"crossing:markings": "yes"
},
"reference": {
"key": "crossing",
"value": "marked"
},
"name": "{highway/path/crossing/uncontrolled}",
"searchable": false
}

View file

@ -0,0 +1,30 @@
{
"icon": "temaki-railway_signals",
"fields": [
"crossing",
"{@templates/crossing/traffic_signal}",
"{@templates/crossing/markings}",
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/traffic_signal_more}",
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}",
"flashing_lights"
],
"geometry": [
"line"
],
"tags": {
"highway": "path",
"path": "crossing",
"crossing": "traffic_signals"
},
"reference": {
"key": "crossing",
"value": "traffic_signals"
},
"name": "Cycle & Foot Crossing With Pedestrian Signals",
"searchable": false
}

View file

@ -0,0 +1,28 @@
{
"icon": "temaki-pedestrian",
"fields": [
"crossing",
"{@templates/crossing/markings_yes}",
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}",
"flashing_lights"
],
"geometry": [
"line"
],
"tags": {
"highway": "path",
"path": "crossing",
"crossing": "uncontrolled"
},
"reference": {
"key": "crossing",
"value": "uncontrolled"
},
"name": "Marked Cycle & Foot Crossing",
"searchable": false
}

View file

@ -0,0 +1,33 @@
{
"icon": "temaki-pedestrian",
"fields": [
"crossing",
"{@templates/crossing/defaults}",
"surface"
],
"moreFields": [
"{@templates/crossing/geometry_way_more}",
"{@templates/crossing/bicycle_more}",
"flashing_lights"
],
"geometry": [
"line"
],
"tags": {
"highway": "path",
"path": "crossing",
"crossing": "unmarked"
},
"addTags": {
"highway": "path",
"path": "crossing",
"crossing": "unmarked",
"crossing:markings": "no"
},
"reference": {
"key": "crossing",
"value": "unmarked"
},
"name": "Unmarked Cycle & Foot Crossing",
"searchable": false
}

View file

@ -12,7 +12,7 @@
"license": "ISC",
"main": "build.js",
"scripts": {
"lint": "prettier --check data",
"lint": "prettier --check 'data/**/!(*.md)'",
"lint:fix": "prettier --write data",
"build": "node scripts/build.js",
"dist": "node scripts/dist.js",