GetRoute HTTP POST Options
HTTP POST URL Format
In addition to the regular HTTP GET parameters, you can add HTTP POST payload options to your request that specifies intermediate points, transient updates, and priority for road types. The content type must be set to application/json. The following format is used for HTTP POST requests:
HTTP POST: /rest/Spatial/erm/databases/dbsource.json?q=route&query_parameters
POST BODY: Content-Type:application/json {Route Data}
Intermediate Points
A list of intermediate points to include along the route. To include a set of intermediate points in a HTTP POST request, add the MultiPoint JSON payload indicating the points that the route will include. If intermediate points are specified both in the URL and in the json payload, the json payload is given preference, and the intermediate points in URL are ignored.
Example intermediate points HTTP POST payload.
{
"intermediatePoints": {"type": "MultiPoint","crs": {"type": "name","properties": {"name": "epsg:4326"}},"coordinates": [[ -73.976266,40.788717],[ -73.973562,40.792193],[ -73.971802,40.794630]]}
}
Transient Updates
This set of preferences allows you to set transient updates for each request. For instance, you can request that the server attempt to avoid all of the major road types. Each request can contain one or more updates. For speed updates, positive speed value is a speed increase and negative speed value is a speed decrease. The following is a description of the transient update types:
Update Type |
Description |
---|---|
point |
Point updates are changes applied to a corresponding point (Latitude, Longitude). For a particular point, you can: exclude the point, set the speed of the point or change (increase or decrease) the speed of the point by a value or percentage. Use one of the following types of updates:
|
segmentID |
Segment updates are changes applied to a corresponding segment ID. For a particular segment, you can: exclude the segment, set the speed of the segment, change (increase or decrease) the speed of the segment by a value or percentage, or change the road type of the segment. Use one of the following types of updates:
|
roadType |
Road type updates are changes applied to a corresponding road type. For a particular road type, you can: set the speed of the roadtype, or change (increase or decrease) the speed of the road type by a value or percentage. Use one of the following types of updates:
|
Example transient update HTTP POST payload.
{
"transientUpdates": [
{
"segmentID": "specify a segment id",
"updates": [
{"exclude": "Y"},
{"roadType": "a road type"},
{"percentage": 26.0},
{"speed": { "velocity": 25, "velocityUnit": "kph"}},
{"percentage": -13.5},
{"speedAdjustment" : { "velocity": 5, "velocityUnit": "kph"}}
]
},
{
"point": "specify a geojson point",
"updates": [
{"exclude": "Y"},
{"percentage": 26.0},
{"speed": { "velocity": 25, "velocityUnit": "kph"}},
{"percentage": -13.5},
{"speedAdjustment" : { "velocity": 5, "velocityUnit": "kph"}}
]
},
{
"roadType": "specify a road type",
"updates": [
{"percentage": 26.0},
{"speed": { "velocity": 25, "velocityUnit": "kph"}},
{"percentage": -13.5},
{"speedAdjustment" : { "velocity": 5, "velocityUnit": "kph"}}
]
}
]
}
Road Type Priority
Specifies the priority to give to different types of roads when determining the route. The following is a description of the road type priority options:
Option |
Description |
---|---|
high |
Prefer the road type over other road types. |
medium |
Give this road type equal preference with other road types. If no preference is specified for a road type, the default is Medium. |
low |
Prefer other road types over this road type. |
avoid |
Exclude the road type from routes if possible. It is not always possible to exclude a road type from the travel directions. Depending on the situation, the alternative to an avoided road type may be so poor that the software will choose a route that uses an avoided road type. Also, if the starting or ending point lies along a segment whose road type has been avoided, the software will still use that segment. |
Example road type priority HTTP POST payload.
{
" roadTypesPriority ": {
"RoadType.MajorRoadDenseUrban": "High",
"RoadType.LimitedAccessDenseUrban":"Low",
"RoadType.LimitedAccessRural":"Medium",
"RoadType.PrimaryHighwayUrban":"Avoid"
}
}