I am trying to utilize openrouteservice optimization endpoint, but I need an example. All examples are related to Jobs function, but I can’t find any related to Shipment. Here is a part that I managed so far:
vehicles = []
for idx, coords in enumerate(vehicle_locations):
vehicles.append(ors.optimization.Vehicle(
id=idx,
profile='driving-car',
start=coords,
end=coords,
capacity=[300] # Limit capacity so only 3 jobs can be taken by each vehicle
))
folium.Marker(location=list(reversed(coords)), icon=folium.Icon(icon='truck', prefix='fa')).add_to(m)
shipments=[]
for idx, coords in enumerate(shipment_locations):
pickup = dict(id=idx, location = coords, description = "load", amount=[1] )
delivery = dict(id=idx, location = coords, description = "unload", amount=[1] )
shipments.append(ors.optimization.Shipment(
pickup=pickup,
delivery=delivery
))
folium.Marker(location=list(reversed(coords)), icon=folium.Icon(icon='archive', prefix='fa', color='green')).add_to(m)
optimized = client.optimization(
shipments=shipments,
vehicles=vehicles,
geometry=True, ## will output the geometry,
)
The error what I am getting is:
Exception has occurred: AssertionError
exception: no description
Is there any working example of how to properly assemble shipments?