We’ve found an odd issue where the directions/route optimization fails when including 3 specific locations on the same road:
GraphHopper maps link:
Optimization request:
{
"configuration": {
"routing": {
"calc_points": true,
"consider_traffic": false,
"return_snapped_waypoints": true,
"network_data_provider": "openstreetmap",
"snap_preventions": [
"motorway",
"tunnel",
"ferry"
],
"fail_fast": false
},
"optimization": {
"free_insertion": false
}
},
"vehicle_types": [
{
"type_id": "vhc_1HI1sK177j3YLKjIlsOm",
"profile": "car",
"capacity": [
50000000
],
"speed_factor": 1,
"service_time_factor": 1
}
],
"vehicles": [
{
"type_id": "vhc_1HI1sK177j3YLKjIlsOm",
"vehicle_id": "1HI1sK177j3YLKjIlsOm",
"start_address": {
"location_id": "start_address",
"lat": 40.1970028,
"lon": -79.8271451,
"curbside": "any"
},
"return_to_depot": false,
"earliest_start": 1771920000,
"min_jobs": 1
}
],
"objectives": [
{
"type": "min-max",
"value": "completion_time"
}
],
"services": [
{
"id": "EuAI5hsKQ9SWfsAF1plW",
"address": {
"location_id": "EuAI5hsKQ9SWfsAF1plW",
"lat": 40.0977311,
"lon": -80.2200606,
"curbside": "any"
},
"duration": 600,
"time_windows": [],
"size": [
1
],
"priority": 2,
"type": "delivery"
},
{
"id": "pe8ArKsu3ERXFa0m4z9p",
"address": {
"location_id": "pe8ArKsu3ERXFa0m4z9p",
"lat": 40.09803350000001,
"lon": -80.2197355,
"curbside": "any"
},
"duration": 600,
"time_windows": [],
"size": [
1
],
"priority": 2,
"type": "delivery"
},
{
"id": "qLLEzEnts6NrUqXVJ2ym",
"address": {
"location_id": "qLLEzEnts6NrUqXVJ2ym",
"lat": 40.0974720,
"lon": -80.2198525,
"curbside": "any"
},
"duration": 600,
"time_windows": [],
"size": [
1
],
"priority": 2,
"type": "delivery"
}
],
"shipments": [],
"relations": []
}
Both of these return a weird error like:
distances must be non-negative, got: -565
I’ve checked out the road on OSM and couldn’t see anything unusual that could be causing this issue:
Removing any of the 3 locations makes it calculate successfully.