graphhopper / directions-api-js-client

JavaScript client for the GraphHopper Directions API
https://graphhopper.com/api/1/examples
108 stars 85 forks source link

How to use Route Optimization API? #26

Closed MaryCooperGD closed 7 years ago

MaryCooperGD commented 7 years ago

Hi, I've installed the js client and I would like to use Route Optimization API, but I'm not sure how I can use it. I've required the whole client using require('graphhopper-js-api-client') and tried to call Routing with the parameter optimize:true as explained here :

var ghRouting = new GraphHopper.Routing({key: defaultKey, host: host, vehicle:profile,elevation:false,optimize:true})

The response I get are the points not sorted, they are in the order I've added them. I've also tried using var ghRouting = new GraphHopper.Optimization({key: defaultKey, host: host, vehicle_types:profile,elevation:false,calc_points:true})

But doesn't work. In the docs for Route Optimization API is not explained how to specifiy parameters for the constructor, so I'm a bit stuck.

karussell commented 7 years ago

cross posted https://discuss.graphhopper.com/t/use-routing-api-with-optimize-true/2404