From 5afdfc527b8bb6152a0eeb15f65f8cba51f20e65 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 29 Dec 2019 17:27:41 +0000 Subject: [PATCH] Add support for more Osmose error types - Missing parking access - Malformed opening hours tagging - Objects detected by Mapillary that aren't mapped - Traffic sign information detected by Mapillary that isn't mapped Mapillary errors add example code for special error type handling as they don't need to request further details and can use piecewise translation strings --- css/65_data.css | 10 +++++ data/core.yaml | 25 +++++++++++- data/qa_errors.json | 56 +++++++++++++++++++++----- dist/locales/en.json | 31 +++++++++++++- modules/services/osmose.js | 19 +++++++-- scripts/build_data.js | 3 +- svg/fontawesome/fas-weight-hanging.svg | 1 + 7 files changed, 129 insertions(+), 16 deletions(-) create mode 100644 svg/fontawesome/fas-weight-hanging.svg diff --git a/css/65_data.css b/css/65_data.css index 9dfc509c0..7a885e8be 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -169,6 +169,16 @@ color: #DCB000; } +.osmose.category-3161, +.osmose.category-3250 { + color: #2D9359; +} + +.osmose.category-8300, +.osmose.category-8360 { + color: #3DE736; +} + /* Custom Map Data (geojson, gpx, kml, vector tile) */ .layer-mapdata { pointer-events: none; diff --git a/data/core.yaml b/data/core.yaml index a10db48cc..340b64a60 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -862,7 +862,30 @@ en: description: '{0} and {1} overlap.' 1280-1: title: 'Incorrect Speed Camera' - description: 'Speed camera should be on the highway or part of an "enforcement" relation.' + description: '{0} should be on the highway or part of an "enforcement" relation.' + 3161: + title: 'Missing Parking Access' + description: 'There is no highway leading to {0}.' + 3250-32501: + title: 'Invalid Opening Hours' + description: '{0} has an invalid value for the "opening_hours" tag.' + 8300: + title: 'Traffic Sign Suggestion' + description: 'Traffic signs detected by Mapillary suggest there may be an unmapped {0} nearby.' + parts: + 20: 'max height limit' + 21: 'max weight limit' + 32: 'roundabout' + 34: 'set of speed bumps' + 8360: + title: 'Missing Street Object' + description: 'Object detection by Mapillary suggests there may be an unmapped {0} nearby.' + parts: + 1: 'bench' + 2: 'type of bicycle parking' + 3: 'surveillance camera' + 4: 'fire hydrant' + 5: 'set of traffic signals' improveOSM: title: ImproveOSM Detection geometry_types: diff --git a/data/qa_errors.json b/data/qa_errors.json index 5fe329ff8..e0122a371 100644 --- a/data/qa_errors.json +++ b/data/qa_errors.json @@ -34,7 +34,7 @@ } }, "osmose": { - "items": ["0", "1040", "1050", "1070", "1150", "1280"], + "items": ["0", "1040", "1050", "1070", "1150", "1280", "3161", "3250", "8300", "8360"], "errorTypes": { "0-1": { "icon": "maki-home" @@ -51,15 +51,6 @@ "1050-1050": { "icon": "maki-circle-stroked" }, - "1150-1": { - "icon": "far-clone" - }, - "1150-2": { - "icon": "far-clone" - }, - "1150-3": { - "icon": "far-clone" - }, "1070-1": { "icon": "maki-home" }, @@ -75,8 +66,53 @@ "1070-10": { "icon": "maki-cross" }, + "1150-1": { + "icon": "far-clone" + }, + "1150-2": { + "icon": "far-clone" + }, + "1150-3": { + "icon": "far-clone" + }, "1280-1": { "icon": "maki-attraction" + }, + "3161-1": { + "icon": "maki-parking" + }, + "3161-2": { + "icon": "maki-parking" + }, + "3250-32501": { + "icon": "maki-watch" + }, + "8300-20": { + "icon": "temaki-height_restrictor" + }, + "8300-21": { + "icon": "fas-weight-hanging" + }, + "8300-32": { + "icon": "maki-circle-stroked" + }, + "8300-34": { + "icon": "temaki-diamond" + }, + "8360-1": { + "icon": "temaki-bench" + }, + "8360-2": { + "icon": "maki-bicycle" + }, + "8360-3": { + "icon": "temaki-security_camera" + }, + "8360-4": { + "icon": "temaki-fire_hydrant" + }, + "8360-5": { + "icon": "temaki-traffic_signals" } } } diff --git a/dist/locales/en.json b/dist/locales/en.json index d2204cd95..b4a04fda9 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1046,6 +1046,31 @@ "title": "Overlapping Similar Areas", "description": "{0} and {1} overlap." }, + "3161": { + "title": "Missing Parking Access", + "description": "There is no highway leading to {0}." + }, + "8300": { + "title": "Traffic Sign Suggestion", + "description": "Traffic signs detected by Mapillary suggest there may be an unmapped {0} nearby.", + "parts": { + "20": "max height limit", + "21": "max weight limit", + "32": "roundabout", + "34": "set of speed bumps" + } + }, + "8360": { + "title": "Missing Street Object", + "description": "Object detection by Mapillary suggests there may be an unmapped {0} nearby.", + "parts": { + "1": "bench", + "2": "type of bicycle parking", + "3": "surveillance camera", + "4": "fire hydrant", + "5": "set of traffic signals" + } + }, "0-3": { "title": "Suspiciously Small Building", "description": "{0} is a suspisciously small building." @@ -1077,7 +1102,11 @@ }, "1280-1": { "title": "Incorrect Speed Camera", - "description": "Speed camera should be on the highway or part of an \"enforcement\" relation." + "description": "{0} should be on the highway or part of an \"enforcement\" relation." + }, + "3250-32501": { + "title": "Invalid Opening Hours", + "description": "{0} has an invalid value for the \"opening_hours\" tag." } } }, diff --git a/modules/services/osmose.js b/modules/services/osmose.js index 7408480eb..8a495e982 100644 --- a/modules/services/osmose.js +++ b/modules/services/osmose.js @@ -3,6 +3,7 @@ import RBush from 'rbush'; import { dispatch as d3_dispatch } from 'd3-dispatch'; import { json as d3_json } from 'd3-fetch'; +import { dataEn } from '../../data'; import { geoExtent, geoVecAdd } from '../geo'; import { qaError } from '../osm'; import { utilRebind, utilTiler, utilQsString } from '../util'; @@ -92,7 +93,6 @@ export default { loadErrors: function(projection) { var params = { - level: '1,2,3', item: services.osmose.items.join() // only interested in certain errors }; @@ -137,10 +137,23 @@ export default { service: 'osmose', error_type: type, // Extra details needed for this service - identifier: props.issue_id, // this is used to post changes to the error - item: props.item // category of the issue for styling + identifier: props.issue_id, // needed to query and update the error + item: props.item, // category of the issue for styling + class: props.class }); + // Special handling for some error types + // Setting elems here prevents UI error detail requests + var parts = dataEn.QA.osmose.error_types[d.item].parts; + switch (d.item) { + case 8300: + case 8360: + // todo: possible to add link to open mapillay photo overlay? + d.replacements = [parts[d.class]]; + d.elems = []; + break; + } + _erCache.data[d.id] = d; _erCache.rtree.insert(encodeErrorRtree(d)); } diff --git a/scripts/build_data.js b/scripts/build_data.js index a5c7c2ef7..e5ddff4bf 100644 --- a/scripts/build_data.js +++ b/scripts/build_data.js @@ -70,7 +70,8 @@ function buildData() { 'fas-long-arrow-alt-right': {}, 'fas-th-list': {}, 'fas-user-cog': {}, - 'far-clone': {} + 'far-clone': {}, + 'fas-weight-hanging': {} }; // The Noun Project icons used diff --git a/svg/fontawesome/fas-weight-hanging.svg b/svg/fontawesome/fas-weight-hanging.svg new file mode 100644 index 000000000..10ce728a4 --- /dev/null +++ b/svg/fontawesome/fas-weight-hanging.svg @@ -0,0 +1 @@ + \ No newline at end of file