diff --git a/data/core.yaml b/data/core.yaml index 1893dc9ed..95ad8d4e2 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1306,6 +1306,12 @@ en: tip: "Find features that should possibly be connected to other nearby features" highway-highway: reference: Intersecting highways should share a junction vertex. + close_nodes: + title: "Very Close Points" + message: "Two points in {way} are very close together" + tip: "Find redundant points in ways" + ref_merge: "Nodes are less than 2 meters away; you may want to merge them." + ref_move_away: "Nodes are less than 2 meters away but not mergable; you may want to move them further apart." crossing_ways: title: Crossings Ways message: "{feature} crosses {feature2}" @@ -1403,11 +1409,6 @@ en: unknown_road: message: "{feature} has no classification" reference: "Roads without a specific type may not appear in maps or routing." - dupe_node_on_road: - title: Very close nodes on road - message: "Very close nodes on road" - ref_merge: "Nodes are less than 2 meters away; you may want to merge them." - ref_move_away: "Nodes are less than 2 meters away but not mergable; you may want to move them further apart." impossible_oneway: title: Impossible One-Ways tip: "Find route issues with one-way features" @@ -1447,6 +1448,8 @@ en: title: Continue drawing from end delete_feature: title: Delete this feature + merge_points: + title: Merge these points move_tags: title: Move the tags annotation: Moved tags. @@ -1496,8 +1499,6 @@ en: title: Use different levels use_tunnel: title: Use a tunnel - merge_nodes: - title: Merge these nodes intro: done: done ok: OK diff --git a/dist/locales/en.json b/dist/locales/en.json index 5ef4fd160..ebdb35f47 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1604,6 +1604,13 @@ "reference": "Intersecting highways should share a junction vertex." } }, + "close_nodes": { + "title": "Very Close Points", + "message": "Two points in {way} are very close together", + "tip": "Find redundant points in ways", + "ref_merge": "Nodes are less than 2 meters away; you may want to merge them.", + "ref_move_away": "Nodes are less than 2 meters away but not mergable; you may want to move them further apart." + }, "crossing_ways": { "title": "Crossings Ways", "message": "{feature} crosses {feature2}", @@ -1737,12 +1744,6 @@ "message": "{feature} has no classification", "reference": "Roads without a specific type may not appear in maps or routing." }, - "dupe_node_on_road": { - "title": "Very close nodes on road", - "message": "Very close nodes on road", - "ref_merge": "Nodes are less than 2 meters away; you may want to merge them.", - "ref_move_away": "Nodes are less than 2 meters away but not mergable; you may want to move them further apart." - }, "impossible_oneway": { "title": "Impossible One-Ways", "tip": "Find route issues with one-way features", @@ -1799,6 +1800,9 @@ "delete_feature": { "title": "Delete this feature" }, + "merge_points": { + "title": "Merge these points" + }, "move_tags": { "title": "Move the tags", "annotation": "Moved tags." @@ -1869,9 +1873,6 @@ }, "use_tunnel": { "title": "Use a tunnel" - }, - "merge_nodes": { - "title": "Merge these nodes" } } }, diff --git a/modules/validations/dupe_node_on_road.js b/modules/validations/close_nodes.js similarity index 77% rename from modules/validations/dupe_node_on_road.js rename to modules/validations/close_nodes.js index 78f6f7022..618b45a09 100644 --- a/modules/validations/dupe_node_on_road.js +++ b/modules/validations/close_nodes.js @@ -1,18 +1,21 @@ import { operationMerge } from '../operations/index'; +import { utilDisplayLabel } from '../util'; import { t } from '../util/locale'; import { validationIssue, validationIssueFix } from '../core/validation'; +import { osmRoutableHighwayTagValues } from '../osm/tags'; import { geoExtent } from '../geo'; -export function validationDupeNodeOnRoad() { - var type = 'dupe_node_on_road'; +export function validationCloseNodes() { + var type = 'close_nodes'; function isNodeOnRoad(node, context) { var parentWays = context.graph().parentWays(node); for (var i = 0; i < parentWays.length; i++) { - if (parentWays[i].tags.highway) { - return true; + var parentWay = parentWays[i]; + if (osmRoutableHighwayTagValues[parentWay.tags.highway]) { + return parentWay; } } return false; @@ -39,7 +42,11 @@ export function validationDupeNodeOnRoad() { var validation = function(entity, context) { - if (entity.type !== 'node' || !isNodeOnRoad(entity, context)) return []; + + if (entity.type !== 'node') return []; + + var road = isNodeOnRoad(entity, context); + if (!road) return []; var dupe = findDupeNode(entity, context); if (dupe === null) return []; @@ -50,7 +57,7 @@ export function validationDupeNodeOnRoad() { fixes.push( new validationIssueFix({ icon: 'iD-icon-plus', - title: t('issues.fix.merge_nodes.title'), + title: t('issues.fix.merge_points.title'), onClick: function() { var entities = this.issue.entities, operation = operationMerge([entities[0].id, entities[1].id], context); @@ -65,7 +72,7 @@ export function validationDupeNodeOnRoad() { return [new validationIssue({ type: type, severity: 'warning', - message: t('issues.dupe_node_on_road.message'), + message: t('issues.close_nodes.message', { way: utilDisplayLabel(road, context) }), reference: showReference, entities: [entity, dupe], fixes: fixes @@ -74,8 +81,8 @@ export function validationDupeNodeOnRoad() { function showReference(selection) { var referenceText = mergable - ? t('issues.dupe_node_on_road.ref_merge') - : t('issues.dupe_node_on_road.ref_move_away'); + ? t('issues.close_nodes.ref_merge') + : t('issues.close_nodes.ref_move_away'); selection.selectAll('.issue-reference') .data([0]) .enter() diff --git a/modules/validations/index.js b/modules/validations/index.js index a2dd6b6c9..cecaafeb5 100644 --- a/modules/validations/index.js +++ b/modules/validations/index.js @@ -1,7 +1,7 @@ export { validationAlmostJunction } from './almost_junction'; +export { validationCloseNodes } from './close_nodes'; export { validationCrossingWays } from './crossing_ways'; export { validationDisconnectedWay } from './disconnected_way'; -export { validationDupeNodeOnRoad } from './dupe_node_on_road'; export { validationFixmeTag } from './fixme_tag'; export { validationGenericName } from './generic_name'; export { validationImpossibleOneway } from './impossible_oneway';