Fix one-way error positioning and description

The direction of travel in the description was misleading as the way
segment wasn't necessary linear and so the direction could change as you
travel along the way. This is more explicit as it specifies the detected
start/end nodes (also useful to show that it's not the whole way that
might be one-way).

The position is now taken as the central node in the `feature.points`
list (or the average of the central two when there are an even number of
points).
This commit is contained in:
SilentSpike
2019-01-30 20:11:52 +00:00
parent 4157cb1f25
commit 60128b0402
3 changed files with 17 additions and 8 deletions
+1 -1
View File
@@ -680,7 +680,7 @@ en:
error_types:
ow:
title: Missing One-way
description: 'Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel {travel_direction}. There may be missing a "oneway" tag.'
description: 'Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel from {from_node} to {to_node}. There may be missing a "oneway" tag.'
mr:
title: Missing Geometry
description: '{num_trips} recorded trips in this area suggest there may be unmapped {geometry_type} here.'
+1 -1
View File
@@ -824,7 +824,7 @@
"error_types": {
"ow": {
"title": "Missing One-way",
"description": "Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel {travel_direction}. There may be missing a \"oneway\" tag."
"description": "Along this section of {highway}, {percentage}% of {num_trips} recorded trips travel from {from_node} to {to_node}. There may be missing a \"oneway\" tag."
},
"mr": {
"title": "Missing Geometry",
+15 -6
View File
@@ -178,14 +178,22 @@ export default {
// Road segments at high zoom == oneways
if (data.roadSegments) {
data.roadSegments.forEach(function(feature) {
// Travel direction along way segment clarifies one-way direction
var p1 = feature.points[0];
var p2 = feature.points[1];
// Position error at the approximate middle of the segment
var points = feature.points;
var mid = points.length / 2;
var loc;
var dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
// Even number of points, find midpoint of the middle two
// Odd number of points, use position of very middle point
if (mid % 1 == 0) {
loc = pointAverage([points[mid - 1], points[mid]]);
} else {
mid = points[Math.floor(mid)];
loc = [mid.lon, mid.lat];
}
var d = new iOsmError({
loc: pointAverage(feature.points), // TODO: This isn't great for curved roads, would be better to find actual midpoint of segment
loc: loc,
comments: null,
error_subtype: '',
error_type: k,
@@ -205,7 +213,8 @@ export default {
percentage: feature.percentOfTrips,
num_trips: feature.numberOfTrips,
highway: linkErrorObject(t('QA.keepRight.error_parts.highway')),
travel_direction: dir_of_travel
from_node: linkEntity('n' + feature.fromNodeId),
to_node: linkEntity('n' + feature.toNodeId)
};
_erCache.data[d.id] = d;