Unable to create simple single point isochrone

Using the API playground ive made this simple isochrone call:

var request = require('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:

"Unable to build an isochrone map."

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?

please use lat and lon in WGS 84 EPSG:4326
these values are way out of bounds.

Best regards

Thank you Amandus this allowed me to create a API Playgrounds isochrone but I am getting the exact same error on my website attempts.

Sending this body: {“locations”:[[11.680437565757273,55.45628898198001]],“range”:[25]“range_type”:“time”,“units”:“mi”}

to https://api.openrouteservice.org/v2/isochrones/driving-car

I am getting status 500 but unable to create isochrone.

Identical call works on playground though. Is there somewhere in the reponse able to see why it does not send a JSON?

EDIT: Okay I think im on to it.

I made it work, thank Amandus

1 Like