Using the API playground ive made this simple isochrone call:
var request = require('request');
request({
method: 'POST',
url: 'https://api.openrouteservice.org/v2/isochrones/driving-car',
body: '{"locations":[[1317871.4832378423,7467563.562708671]],"range":[60]}',
headers: {
'Accept': 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
'Authorization': 'my api key',
'Content-Type': 'application/json; charset=utf-8'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
Single point as that is the functionality I want for my website.
I get a 500 error:
from Google Chrome:
Status: 500
index.js:381 Headers: {“access-control-allow-origin”:"*",“content-length”:“293”,“content-type”:“application/json”}
index.js:382 Response: {“error”:{“message”:“JSON parse error: Unexpected character (’”’ (code 34)): was expecting comma to separate Object entries; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character (’"’ (code 34)): was expecting comma to separate Object entries\n at [Source: (PushbackInputStream); line: 1, column: 68]"},“info”:{“engine”:{“version”:“6.4.1”,“build_date”:“2021-04-12T11:21:00Z”},“timestamp”:1619789034486}}
This I think is just the stringify being unable to create a JSON out of the response.
From API playground:
{
-
"error"
:
{
"code"
:
3099
,
"message"
:
"Unable to build an isochrone map."
}
,
-
"info"
:
{
-
"engine"
:
{
"version"
:
"6.4.1"
,
"build_date"
:
"2021-04-12T11:21:00Z"
}
,
"timestamp"
:
1619789312909
I get a fine response using the default isochrone call with two locations, both in the playground and from my website.
Why can this call not create an Isochrone?