From ba9fd58fa99d5c5a4e257ca80c9ef61bab32067c Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 2 May 2019 14:49:27 -0700 Subject: [PATCH] Don't flag roads connected only to ferry routes as disconnected (close #6287) Use common routable highway tag list for disconnected way check --- modules/validations/disconnected_way.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/validations/disconnected_way.js b/modules/validations/disconnected_way.js index d1c2a83dc..5c8ef5676 100644 --- a/modules/validations/disconnected_way.js +++ b/modules/validations/disconnected_way.js @@ -2,23 +2,15 @@ import { t } from '../util/locale'; import { modeDrawLine } from '../modes/draw_line'; import { operationDelete } from '../operations/delete'; import { utilDisplayLabel } from '../util'; +import { osmRoutableHighwayTagValues } from '../osm/tags'; import { validationIssue, validationIssueFix } from '../core/validation'; export function validationDisconnectedWay() { var type = 'disconnected_way'; - var highways = { - residential: true, service: true, track: true, unclassified: true, footway: true, - path: true, tertiary: true, secondary: true, primary: true, living_street: true, - cycleway: true, trunk: true, steps: true, motorway: true, motorway_link: true, - pedestrian: true, trunk_link: true, primary_link: true, secondary_link: true, - road: true, tertiary_link: true, bridleway: true, raceway: true, corridor: true, - bus_guideway: true - }; - function isTaggedAsHighway(entity) { - return highways[entity.tags.highway]; + return osmRoutableHighwayTagValues[entity.tags.highway]; } @@ -115,13 +107,18 @@ export function validationDisconnectedWay() { return !parents.some(function(parentWay) { if (parentWay === way) return false; // ignore the way we're testing + // count connections to ferry routes as connected + if (parentWay.tags.route === 'ferry') return true; if (isTaggedAsHighway(parentWay)) return true; - return graph.parentMultipolygons(parentWay).some(function(parentRelation) { + return graph.parentRelations(parentWay).some(function(parentRelation) { // ignore the relation we're testing, if any if (relation && parentRelation === relation) return false; - return isTaggedAsHighway(parentRelation); + if (parentRelation.tags.type === 'route' && + parentRelation.tags.route === 'ferry') return true; + + return parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation); }); }); }