Hello,
I use the Directions service. How can I enter a starting point?
I have embedded a javascript in an html page and need to specify a start point when passing it.
The function looks like this:
let request = new XMLHttpRequest();
request.open('POST', "https://api.openrouteservice.org/v2/directions/driving-hgv/geojson");
request.setRequestHeader('Accept', 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8');
request.setRequestHeader('Content-Type', 'application/json');
request. setRequestHeader('Authorization', 'api-key');
request.onreadystatechange = function () {
if (this. readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
const body = '{"coordinates":[[7.4578615,53.4836767],[8.686507,49.41943],[8.687872,49.420318]], "language": "de-de"}';
request.send(body);
Thank you for your help.
See you
Ralf