From bd1e1b34ffe6cd6da687c518ce3d493edc97ad41 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Wed, 9 Oct 2019 15:24:42 +0200 Subject: [PATCH] Add subtypes to crossing_ways validation warnings Allow the `indoor` tag to indicate a crossing feature is indoors --- ARCHITECTURE.md | 13 +++++++++++++ modules/validations/crossing_ways.js | 17 ++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 1cdfdcadf..45ddc6ec1 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -406,6 +406,19 @@ Two nodes have a very small distance between them. The threshold distance is sma Two ways cross without a junction node or enough information to clarify how they cross. +Building crossings are flagged per-feature. Other subtypes are flagged per-crossing. + +* `building-building` +* `building-highway` +* `building-railway` +* `building-waterway` +* `highway-highway` +* `highway-railway` +* `highway-waterway` +* `railway-railway` +* `railway-waterway` +* `waterway-waterway` + ##### `disconnected_way` One or more interconnected, routable feature are not connected to the rest of the routable network (i.e. they form a routing island). A way is considered connected to the network if any of its nodes are on an unloaded tile, meaning large routing islands may not always be detected. diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index d07e951e2..d1e0d55dd 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -32,8 +32,10 @@ export function validationCrossingWays(context) { return tags[key] !== undefined && tags[key] !== 'no'; } - function tagsImplyIndoors(tags) { - return hasTag(tags, 'level') || tags.highway === 'corridor'; + function taggedAsIndoor(tags) { + return hasTag(tags, 'indoor') || + hasTag(tags, 'level') || + tags.highway === 'corridor'; } function allowsStructures(featureType) { @@ -83,7 +85,7 @@ export function validationCrossingWays(context) { var level1 = tags1.level || '0'; var level2 = tags2.level || '0'; - if (tagsImplyIndoors(tags1) && tagsImplyIndoors(tags2) && level1 !== level2) { + if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) { // assume features don't interact if they're indoor on different levels return true; } @@ -350,13 +352,15 @@ export function validationCrossingWays(context) { var featureType1 = crossing.featureTypes[0]; var featureType2 = crossing.featureTypes[1]; - var isCrossingIndoors = tagsImplyIndoors(entities[0].tags) && tagsImplyIndoors(entities[1].tags); + var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags); var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, 'tunnel') && allowsTunnel(featureType2) && hasTag(entities[1].tags, 'tunnel'); var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, 'bridge') && allowsBridge(featureType2) && hasTag(entities[1].tags, 'bridge'); - var crossingTypeID; + var subtype = crossing.featureTypes.sort().join('-'); + + var crossingTypeID = subtype; if (isCrossingIndoors) { crossingTypeID = 'indoor-indoor'; @@ -364,8 +368,6 @@ export function validationCrossingWays(context) { crossingTypeID = 'tunnel-tunnel'; } else if (isCrossingBridges) { crossingTypeID = 'bridge-bridge'; - } else { - crossingTypeID = crossing.featureTypes.sort().join('-'); } if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) { crossingTypeID += '_connectable'; @@ -408,6 +410,7 @@ export function validationCrossingWays(context) { return new validationIssue({ type: type, + subtype: subtype, severity: 'warning', message: function(context) { var entity1 = context.hasEntity(this.entityIds[0]),