You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been trying to use the isochrone API to generate 10-minute walking isochrones using a list of coordinate pairs but my attempt fails even while iterating over a small number (such as 5) points. I have an enterprise account so should there should be a very high rate limit.
The script will execute the first time on 5 points, but on the second try and subsequent tries, it will throw the following error from isochrone.js :
'data': resp.durations[0],
^
TypeError: Cannot read property 'durations' of undefined
If I include a geojson with many points (such as 100), it will fail every time.
Any ideas on how to solve this?
I have included both the geojson that I am iterating over and the modified index.js file below:
index.js
isochrone = require('./isochrone.js');
var turf = require('@turf/turf');
var fs = require('fs'),
obj
token = 'mytoken'
fs.readFile('poi.geojson', handleFile);
fts = []
function handleFile(err, data) {
if (err) throw err
obj = JSON.parse(data)
features = obj.features
console.log(features.length)
for (var j = 0; j <features.length; j++) {
console.log(j)
coords = features[j].geometry.coordinates
isochrone(coords, {"token":token, "threshold":[600], "mode":"walking", batchSize:25}, function(err, output){
if (err) console.log("not throwing error");
output = output.features
console.log(output)
fts.push(output[0]);
if (j >= features.length){console.log('made it to the end')
var collection = JSON.stringify({
features: fts,
type: 'FeatureCollection'
});
fs.writeFileSync('isochrones.geojson', collection);
}
});
}
}
I have been trying to use the isochrone API to generate 10-minute walking isochrones using a list of coordinate pairs but my attempt fails even while iterating over a small number (such as 5) points. I have an enterprise account so should there should be a very high rate limit.
The script will execute the first time on 5 points, but on the second try and subsequent tries, it will throw the following error from isochrone.js :
If I include a geojson with many points (such as 100), it will fail every time.
Any ideas on how to solve this?
I have included both the geojson that I am iterating over and the modified index.js file below:
index.js
poi.geojson
The text was updated successfully, but these errors were encountered: