Skip to content
GuidesPlaygroundDashboard

Optimize

Optimize route through waypoints
client.Optimize.New(ctx, body) (*OptimizeResult, error)
POST/api/v1/optimize
Get async optimization result
client.Optimize.Get(ctx, jobID) (*OptimizeJobStatus, error)
GET/api/v1/optimize/{job_id}
ModelsExpand Collapse
type OptimizeCompletedResult struct{…}

Completed optimization — GeoJSON Feature with optimized route

Coordinates GeoJsonGeometryCoordinatesUnion

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
type GeoJsonGeometryCoordinatesArray []float64
type GeoJsonGeometryCoordinatesArray [][]float64
type GeoJsonGeometryCoordinatesArray [][][]float64
type GeoJsonGeometryCoordinatesArray [][][][]float64
Type GeoJsonGeometryType
One of the following:
const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"
const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"
const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"
const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"
const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"
const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"
Properties OptimizeCompletedResultProperties
Distance float64optional

Total distance in meters

Duration float64optional

Estimated duration in seconds

WaypointOrder []int64optional

Optimized waypoint ordering

Status OptimizeCompletedResultStatus

Job status

Type OptimizeCompletedResultType
type OptimizeJobStatus struct{…}

Status of an async optimization job

Status OptimizeJobStatusStatus

Job status

One of the following:
const OptimizeJobStatusStatusCompleted OptimizeJobStatusStatus = "completed"
const OptimizeJobStatusStatusProcessing OptimizeJobStatusStatus = "processing"
const OptimizeJobStatusStatusFailed OptimizeJobStatusStatus = "failed"
Error stringoptional

Error message when failed

Result unknownoptional

Optimization result when completed

type OptimizeProcessingResult struct{…}

Async optimization in progress — poll with the job_id

JobID string

Job ID for polling

Status OptimizeProcessingResultStatus

Job status

type OptimizeRequest struct{…}

Route optimization request through waypoints

Waypoints GeoJsonGeometry

Waypoints to visit (GeoJSON MultiPoint geometry, minimum 2 points)

Coordinates GeoJsonGeometryCoordinatesUnion

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
type GeoJsonGeometryCoordinatesArray []float64
type GeoJsonGeometryCoordinatesArray [][]float64
type GeoJsonGeometryCoordinatesArray [][][]float64
type GeoJsonGeometryCoordinatesArray [][][][]float64
Type GeoJsonGeometryType
One of the following:
const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"
const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"
const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"
const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"
const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"
const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"
Mode OptimizeRequestModeoptional

Travel mode (default: auto)

One of the following:
const OptimizeRequestModeAuto OptimizeRequestMode = "auto"
const OptimizeRequestModeFoot OptimizeRequestMode = "foot"
const OptimizeRequestModeBicycle OptimizeRequestMode = "bicycle"
Roundtrip booloptional

Whether route returns to start (default: true)

type OptimizeResult interface{…}

Optimization response — either a completed GeoJSON Feature route or an async job reference

One of the following:
type OptimizeCompletedResult struct{…}

Completed optimization — GeoJSON Feature with optimized route

Coordinates GeoJsonGeometryCoordinatesUnion

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
type GeoJsonGeometryCoordinatesArray []float64
type GeoJsonGeometryCoordinatesArray [][]float64
type GeoJsonGeometryCoordinatesArray [][][]float64
type GeoJsonGeometryCoordinatesArray [][][][]float64
Type GeoJsonGeometryType
One of the following:
const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"
const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"
const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"
const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"
const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"
const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"
Properties OptimizeCompletedResultProperties
Distance float64optional

Total distance in meters

Duration float64optional

Estimated duration in seconds

WaypointOrder []int64optional

Optimized waypoint ordering

Status OptimizeCompletedResultStatus

Job status

Type OptimizeCompletedResultType
type OptimizeProcessingResult struct{…}

Async optimization in progress — poll with the job_id

JobID string

Job ID for polling

Status OptimizeProcessingResultStatus

Job status