I’m needing to get distances between each lake for a series of lakes. I’m running a shell script from the Mac OSX command line to request those distances, below is an example from the script. Due to the number of distances I’m eventually needing, ~28,000, I’ve broken them into separate scripts of 2,000 requests each, so I stay within the daily limit.
I ran the first script this afternoon, and after approximately 377 requests, it started throwing the “Daily quota reached or API key unauthorized” error. As it was running unattended, I didn’t notice the errors. It continued to throw the errors for the next 408 requests, then began working again for about another 500 requests, then threw the errors again so I cancelled the script. Any idea of what might be going on?
Also, I discovered that there is a response header that gives you your usage, X-RATELIMIT
, but It’s not being returned to me when I post. Here’s is an example of everything that is being returned. (Please note that due to limitations on new users, I had to change the “.” to a “_” on ‘metadata":{“attribution”:"openrouteservice_org’ here in the topic so it wouldn’t count as a linked source.)
Distance from:to Alma City Lake KS -> Antelope Lake KS
{“distances”:[[0.0,246.47],[246.43,0.0]],“destinations”:[{“location”:[-96.26342,38.978664],“snapped_distance”:233.39},{“location”:[-100.11083,39.372614],“snapped_distance”:219.17}],“sources”:[{“location”:[-96.26342,38.978664],“snapped_distance”:233.39},{“location”:[-100.11083,39.372614],“snapped_distance”:219.17}],“metadata”:{“attribution”:“openrouteservice_org | OpenStreetMap contributors”,“service”:“matrix”,“timestamp”:1593626938545,“query”:{“locations”:[[-96.2611607,38.979813],[-100.112218,39.3742674]],“profile”:“driving-car”,“responseType”:“json”,“metricsStrings”:[“DISTANCE”],“metrics”:[“distance”],“units”:“mi”},“engine”:{“version”:“6.1.1”,“build_date”:“2020-06-18T15:14:48Z”,“graph_date”:“2020-06-26T00:40:56Z”}}}
I appreciate any help that you can provide.
Thanks.
[shell script example]
echo '\nDistance from:to Alma City Lake KS -> Antelope Lake KS ’
curl -X POST
‘https://api.openrouteservice.org/v2/matrix/driving-car’
-H ‘Content-Type: application/json; charset=utf-8’
-H ‘Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8’
-H ‘Authorization: xxx’
-d '{ “locations”:[[ -96.2611607 , 38.979813 ],[ -100.112218 , 39.3742674 ]], “metrics” :[“distance”],“units”:“mi”} ’
sleep 2
echo '\nDistance from:to Alma City Lake KS -> Arkansas City Knebler KS ’
curl -X POST
‘https://api.openrouteservice.org/v2/matrix/driving-car’
-H ‘Content-Type: application/json; charset=utf-8’
-H ‘Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8’
-H ‘Authorization: xxx’
-d '{ “locations”:[[ -96.2611607 , 38.979813 ],[ -97.0239685 , 37.0702788 ]], “metrics” :[“distance”],“units”:“mi”} ’
sleep 2