From fe892f7d2048031336782b71aea3eb2d7d7cee6e Mon Sep 17 00:00:00 2001 From: Fan-Wu Yang Date: Mon, 15 Oct 2018 16:32:48 +1300 Subject: [PATCH] Changed distance ending distance to be larger due to gps inconsistencies --- api/v1/api.js | 2 +- api/v1/areaFunctions.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/v1/api.js b/api/v1/api.js index bff6145..2a0e25b 100644 --- a/api/v1/api.js +++ b/api/v1/api.js @@ -48,7 +48,7 @@ module.exports = { let lastPoint = points[points.length - 1]; let distance = mathFunc.gpsToMeters(firstPoint.lat, firstPoint.lng, lastPoint.lat, lastPoint.lng); console.log(distance); - if (distance < 10) { + if (distance < 20) { if (lastPoint.lat != firstPoint.lat && lastPoint.lng != firstPoint.lng) { // points.pop(); points.push({lat: firstPoint.lat, lng: lastPoint.lng}); diff --git a/api/v1/areaFunctions.js b/api/v1/areaFunctions.js index ba40277..3336f9e 100644 --- a/api/v1/areaFunctions.js +++ b/api/v1/areaFunctions.js @@ -25,7 +25,8 @@ module.exports = { return polygons }, submitFinalCollation(res, gameID, userID, points, area, mergedPolygonIDs) { - query = util.format("CALL insertPolygon(\"%s\", \"%s\", %d)", gameID, userID, area); + let query = util.format("CALL insertPolygon(\"%s\", \"%s\", %d)", gameID, userID, area); + console.log(query); db.get().query(query, function(err, rows) { if (err) { console.log(err); @@ -85,6 +86,7 @@ module.exports = { let polygonResult = []; let polygonsMerged = []; polygons.map((polygon) => { + console.log(polygon); if (polygon[0].lat != polygon[polygon.length - 1].lat && polygon[0].lng != polygon[polygon.length - 1].lng) { polygon.push({lat: polygon[0].lat, lng: polygon[0].lng})