mapbox / mapbox/mapbox-isochrone
rate limiting w/ enterprise
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 119
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
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){console.log('made it to the end')
var collection = JSON.stringify({
features: fts,
type: 'FeatureCollection'
});
fs.writeFileSync('isochrones.geojson', collection);
}
});
}
}
```
poi.geojson
```
{
"type": "FeatureCollection",
"name": "poi",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "stop_id": 6, "stop_name": "Jackson & Lotus", "stop_lat": 41.876513, "stop_lon": -87.761446 }, "geometry": { "type": "Point", "coordinates": [ -87.761446, 41.876513 ] } },
{ "type": "Feature", "properties": { "stop_id": 2, "stop_name": "5900 W Jackson", "stop_lat": 41.87706679, "stop_lon": -87.77131794 }, "geometry": { "type": "Point", "coordinates": [ -87.77131794, 41.87706679 ] } },
{ "type": "Feature", "properties": { "stop_id": 1, "stop_name": "Jackson & Austin Terminal", "stop_lat": 41.87632184, "stop_lon": -87.77410482000001 }, "geometry": { "type": "Point", "coordinates": [ -87.77410482, 41.87632184 ] } },
{ "type": "Feature", "properties": { "stop_id": 4, "stop_name": "5700 W Jackson", "stop_lat": 41.87702418, "stop_lon": -87.76745055000001 }, "geometry": { "type": "Point", "coordinates": [ -87.76745055, 41.87702418 ] } },
{ "type": "Feature", "properties": { "stop_id": 3, "stop_name": "Jackson & Menard", "stop_lat": 41.87695725, "stop_lon": -87.76975039 }, "geometry": { "type": "Point", "coordinates": [ -87.76975039, 41.87695725 ] } }
]
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied index.js and isochrone.js, then run the example with five points and with the larger GeoJSON. Inspect how concurrent requests, batchSize, and error responses are handled before the durations access. Done means repeated and larger runs handle the response without the reported TypeError and produce the expected isochrones.geojson output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100