Hello
I’ve used PHP to automatically generate a geojson file. This works, however, I want to use the feedback I get to update delivery times, but for that, I need to be able to include the order number with the coordinates, or find another way to identify which coordinate is which order.
The coords I pass along are e.g.
{“coordinates”:[[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]]}
Is it possible to include ID’s here? Like
{“coordinates”:[ 1 => [8.681495,49.41461], 3=> [8.686507,49.41943],6 =>[8.687872,49.420318]]}
Or any other way to identify them later? If the coordinates themselves would be included in the response (the segments), then I could use those.
Code used (not very relevant):
function getOpenrouteserviceDirections($apiKey, $coordsString){
// openrouteservice
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “https://api.openrouteservice.org/v2/directions/driving-car/geojson”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, ‘{“coordinates”:[’.$coordsString.’]}’);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“Content-Type: application/geo+json”,
“Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8”,
“Authorization: {$apiKey}”
));
$directions = curl_exec($ch);
curl_close($ch);
return $directions;
}