Return an array with meta-data for each coordinate.

Currently supports duration and distance for each coordinate.

This is particularly useful in map-matching, comparing how
a trip progresses compared to a real GPS trace that is
map-matched.
This commit is contained in:
Daniel Patterson
2016-05-08 22:58:13 -07:00
committed by Patrick Niklaus
parent 0f2bb5dde5
commit fa525ad610
13 changed files with 121 additions and 10 deletions
+13 -1
View File
@@ -33,7 +33,9 @@ module.exports = function () {
var subMatchings = [],
turns = '',
route = '',
duration = '';
duration = '',
annotation = '';
if (res.statusCode === 200) {
if (headers.has('matchings')) {
@@ -54,6 +56,11 @@ module.exports = function () {
if (json.matchings.length != 1) throw new Error('*** Checking duration only supported for matchings with one subtrace');
duration = json.matchings[0].duration;
}
if (headers.has('annotation')) {
if (json.matchings.length != 1) throw new Error('*** Checking annotation only supported for matchings with one subtrace');
annotation = this.annotationList(json.matchings[0]);
}
}
if (headers.has('turns')) {
@@ -68,6 +75,10 @@ module.exports = function () {
got.duration = duration.toString();
}
if (headers.has('annotation')) {
got.annotation = annotation.toString();
}
var ok = true;
var encodedResult = '',
extendedTarget = '';
@@ -134,6 +145,7 @@ module.exports = function () {
this.requestUrl(row.request, afterRequest);
} else {
var params = this.queryParams;
params['annotate'] = 'true';
got = {};
for (var k in row) {
var match = k.match(/param:(.*)/);