diff --git a/data/core.yaml b/data/core.yaml
index 6a4195511..a1bd674e7 100644
--- a/data/core.yaml
+++ b/data/core.yaml
@@ -663,16 +663,20 @@ en:
QA:
improveOSM:
title: ImproveOSM Error
+ error_parts:
+ path: path
+ parking_area: parking area
+ road: road
error_types:
ow:
title: Missing One-way
- description: Aggregate data suggests {var1} may be missing a "oneway" tag. Please confirm via imagery or survey before mapping.
+ description: 'Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel in the same direction. There may be missing a "oneway" tag.'
mr:
- title: Missing Road
- description: Aggregate data suggests there may be an unmapped road here. Please confirm via imagery or survey before mapping.
+ title: Missing Geometry
+ description: Aggregate data suggests there may be an unmapped {var1} here.
tr:
title: Missing Turn Restriction
- description: Aggregate data suggests this junction may be missing a turn restriction. Please confirm via imagery or survey before mapping.
+ description: '{num_passed} of {num_trips} recorded trips make a turn from {from_way} to {to_way}. There may be a missing "{turn_restriction}" restriction.'
keepRight:
title: KeepRight Error
detail_title: Error
diff --git a/dist/locales/en.json b/dist/locales/en.json
index bea513f1d..8bc3da440 100644
--- a/dist/locales/en.json
+++ b/dist/locales/en.json
@@ -805,18 +805,23 @@
"QA": {
"improveOSM": {
"title": "ImproveOSM Error",
+ "error_parts": {
+ "path": "path",
+ "parking_area": "parking area",
+ "road": "road"
+ },
"error_types": {
"ow": {
"title": "Missing One-way",
- "description": "Aggregate data suggests {var1} may be missing a \"oneway\" tag. Please confirm via imagery or survey before mapping."
+ "description": "Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel in the same direction. There may be missing a \"oneway\" tag."
},
"mr": {
- "title": "Missing Road",
- "description": "Aggregate data suggests there may be an unmapped road here. Please confirm via imagery or survey before mapping."
+ "title": "Missing Geometry",
+ "description": "Aggregate data suggests there may be an unmapped {var1} here."
},
"tr": {
"title": "Missing Turn Restriction",
- "description": "Aggregate data suggests this junction may be missing a turn restriction. Please confirm via imagery or survey before mapping."
+ "description": "{num_passed} of {num_trips} recorded trips make a turn from {from_way} to {to_way}. There may be a missing \"{turn_restriction}\" restriction."
}
}
},
diff --git a/modules/services/improveOSM.js b/modules/services/improveOSM.js
index faa18044d..8f239ef37 100644
--- a/modules/services/improveOSM.js
+++ b/modules/services/improveOSM.js
@@ -71,6 +71,14 @@ function updateRtree(item, replace) {
}
}
+function linkErrorObject(d) {
+ return '' + d + '';
+}
+
+function linkEntity(d) {
+ return '' + d + '';
+}
+
export default {
init: function() {
if (!_erCache) {
@@ -144,15 +152,25 @@ export default {
// Road segments at high zoom == oneways
if (data.roadSegments) {
data.roadSegments.forEach(function(feature) {
+ // todo: make this take midpoint?
var loc = feature.points[0];
var d = new impOsmError({
loc: [loc.lon, loc.lat],
comments: null,
error_type: k,
+ object_id: feature.wayId,
+ object_type: 'way',
road_type: feature.type
});
+ // Variables used in the description
+ d.replacements = {
+ percentage: feature.percentOfTrips,
+ num_trips: feature.numberOfTrips,
+ highway: linkErrorObject(t('QA.keepRight.error_parts.highway'))
+ };
+
_erCache.data[d.id] = d;
_erCache.rtree.insert(encodeErrorRtree(d));
})
@@ -182,13 +200,30 @@ export default {
data.entities.forEach(function(feature) {
var loc = feature.point;
+ // Elements are presented in a strange way
+ var ids = feature.id.split(',');
+ var from_way = ids[0];
+ var via_node = ids[3];
+ var to_way = ids[2].split(':')[1];
+
var d = new impOsmError({
loc: [loc.lon, loc.lat],
comments: null,
error_type: k,
+ object_id: via_node,
+ object_type: 'node',
turn_type: feature.turnType
});
+ // Variables used in the description
+ d.replacements = {
+ num_passed: feature.numberOfPasses,
+ num_trips: feature.segments[0].numberOfTrips,
+ turn_restriction: feature.turnType.toLowerCase(),
+ from_way: linkEntity('w' + from_way),
+ to_way: linkEntity('w' + to_way)
+ };
+
_erCache.data[d.id] = d;
_erCache.rtree.insert(encodeErrorRtree(d));
})
diff --git a/modules/ui/improveOSM_details.js b/modules/ui/improveOSM_details.js
index cab443ac2..be513ccb0 100644
--- a/modules/ui/improveOSM_details.js
+++ b/modules/ui/improveOSM_details.js
@@ -22,7 +22,7 @@ export function uiImproveOsmDetails(context) {
var detail;
if (et && et.description) {
- detail = t('QA.improveOSM.error_types.' + errorType + '.description');
+ detail = t('QA.improveOSM.error_types.' + errorType + '.description', d.replacements);
} else {
detail = unknown;
}