Optimize route through waypoints
client.optimize.create(OptimizeCreateParams { waypoints, format, mode, roundtrip } params, RequestOptionsoptions?): OptimizeResult
POST/api/v1/optimize
Optimize route through waypoints
import Plaza from '@plazafyi/sdk';
const client = new Plaza({
apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted
});
const optimizeResult = await client.optimize.create({
waypoints: [
{ lat: 48.8566, lng: 2.3522 },
{ lat: 48.8606, lng: 2.3376 },
{ lat: 48.8584, lng: 2.2945 },
],
});
console.log(optimizeResult);{
"features": [
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"cost_s": 0,
"cumulative_cost_s": 0,
"waypoint_index": 0
},
"type": "Feature"
}
],
"optimization": "optimization",
"roundtrip": true,
"total_cost_s": 0,
"type": "FeatureCollection"
}Returns Examples
{
"features": [
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"cost_s": 0,
"cumulative_cost_s": 0,
"waypoint_index": 0
},
"type": "Feature"
}
],
"optimization": "optimization",
"roundtrip": true,
"total_cost_s": 0,
"type": "FeatureCollection"
}