From 91fa58f564e4c2fb24b1446e659e47701caea884 Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Thu, 10 Jun 2021 13:41:37 +1000 Subject: reorder features and set ids for better maproulette tasks --- bin/building.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'bin/building.js') diff --git a/bin/building.js b/bin/building.js index f991be2..c405cdb 100755 --- a/bin/building.js +++ b/bin/building.js @@ -116,12 +116,17 @@ const conflate = new Transform({ const task = { type: 'FeatureCollection', features: [ + ...nearbyMatchedFeatures.map(f => { + // MapRoulette uses the first feature id as the task ID + f.id = feature.id + return f + }), + // last feature is used as the first one shown in MapRoulette point(feature.geometry.coordinates, Object.assign({}, feature.properties, { 'marker-color': 'orange', 'marker-size': 'large', 'OSM Name': nearbyMatchedFeatures[0].properties.name - }, properties)), - ...nearbyMatchedFeatures + }, properties)) ] } outputStreams.mr_singleNearbySimilarFeature.write(task) @@ -131,11 +136,16 @@ const conflate = new Transform({ const task = { type: 'FeatureCollection', features: [ + ...nearbyMatchedFeatures.map(f => { + // MapRoulette uses the first feature id as the task ID + f.id = feature.id + return f + }), + // last feature is used as the first one shown in MapRoulette point(feature.geometry.coordinates, Object.assign({}, feature.properties, { 'marker-color': 'orange', 'marker-size': 'large' - }, properties)), - ...nearbyMatchedFeatures + }, properties)) ] } outputStreams.mr_multipleNearbySimilarFeatures.write(task) @@ -144,7 +154,10 @@ const conflate = new Transform({ const task = { type: 'FeatureCollection', features: [ - point(feature.geometry.coordinates, Object.assign({}, feature.properties, properties)) + point(feature.geometry.coordinates, Object.assign({}, feature.properties, properties), { + // MapRoulette uses the first feature id as the task ID + id: feature.id + }) ] } outputStreams.mr_noNearbySimilarFeature.write(task) -- cgit v1.2.3