[ Whereis® API Home ] [ JSON API Home ] [ Services ] [ Route Services ]
Use this service to calculate the lowest cost order for a series of waypoints, given an origin (startPoint) and a destination (endPoint). The cost is either distance or time depending on route mode and method. Returns the waypoints reordered in optimal form. Note that different route modes and methods may return different results.
URL
HTTP Post to <ENDPOINT>/service/waypoints
Request format
{
"mode":<string>,
"method":<string>,
"tolls": <Boolean>,
"startPoint": <waypoint>,
"endPoint": <waypoint>,
"waypoints":[<waypoint>, <waypoint> ...],
"avoidPoints":[<point>]
}
Rules
Parameter | Mandatory? | Description |
mode | Y | Must be one of "VEHICLE" or "FOOT" |
method | N | Options are:
Default = "FASTEST" This parameter is ignored in "FOOT" mode. |
tolls | N | Default = true This parameter is ignored in "FOOT" mode. |
| startPoint | Y | A <waypoint> object, which may be either a <streetPoint> or a <street> and <centrePoint> pair. |
| endPoint | Y | A <waypoint> object, which may be either a <streetPoint> or a <street> and <centrePoint> pair. |
waypoints | Y | A list of <waypoint> objects, which may be either a <streetPoint> or a <street> and <centrePoint> pair. |
avoidPoints | N | Contains an array of <point> objects, which define locations that the route should not pass through. |
Sample request
{
"mode":"VEHICLE",
"startPoint":{"streetPoint": {"lon": 144.999626, "lat": -37.815655}},
"endPoint":{"streetPoint": {"lon": 145.000479, "lat": -37.811141}},
"waypoints":[
{"streetPoint": {"lon": 144.999999, "lat": -37.813705}},
{"streetPoint": {"lon": 144.999878, "lat": -37.814320}}
]
}
Sample response
For a full explanation of the returned route object, see <route>.
{
"startPoint": {
"streetPoint": {
"lat": -37.815655,
"lon": 144.999626
}
},
"endPoint": {
"streetPoint": {
"lat": -37.811141,
"lon": 145.000479
}
},
"order": [ 1,0 ],
"waypoints": [
{
"streetPoint": {
"lat": -37.81432,
"lon": 144.999878
}
},
{
"streetPoint": {
"lat": -37.813705,
"lon": 144.999999
}
}
],
"routeRequest": <ROUTE>
}
Typically, use a <street> and <centrePoint> when routing to a POI; and a streetPoint if it has been returned in a <geocode>.
Only use a streetPoint if you are certain the point is on a street.