Route Searching API - routing.dijkstra
Route searching uses JSON-RPC. The results are in GeoJSON format.
Endpoint
https://<api-server-endpoint>/api/v1/evwhapi/jsonrpc
Request Example
{
"jsonrpc": "2.0",
"method": "routing.dijkstra",
"params": [
{
"themes": {
"peopleflow_congestiondegree_5min": [0, 0, 0, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000]
},
"start_lonlat": [139.632214, 35.457874],
"goal_lonlat": [139.632108, 35.450862],
"start_datetime": "2018-08-23 14:00:00+09",
"via": [
[139.630030, 35.456772],
[139.635325, 35.458278],
[139.628369, 35.461005],
[139.635849, 35.462663]
],
"map": "adf_170701_v2",
"reorder_waypoints": true,
"with_kml": true
}
],
"id": "routing_dijkstra"
}
Parameters
| parameter name | data type | content | default value |
|---|---|---|---|
| themes | [string, [string,...]] | Risk Map Theme Name | required |
| start_lonlat | [number, number] | Longitude and latitude of the starting point | required |
| goal_lonlat | [number, number] | Longitude and latitude of the end point | required |
| start_datetime | string | Datetime ("YYYY-MM-DD hh:mm:ss+TZ") | required |
| via | array of array of number | Longitude and latitude of transit location | [] (No transit point) |
| map | string | Map data to be used | Determined on the server side |
| reorder_waypoints | boolean | If true, visit order optimization for transit locations is performed | false |
| with_kml | boolean | If true, the response will include KML | false |
Elements of params.themes
| Type | Data Type | Description |
|---|---|---|
| key | string | risk map theme name |
| value | array of number | risk sensitivity |
notes and restrictions
- If risk is not taken into account, then empty object (
{}) should be specified for themes - If the i-th element of risk sensitivity (i = 0, 1, ..., 10) is x , 10) is x, it is interpreted as follows
- Calculate the time required for a risk to pass through region i as (1.0 + x) times
- If you want to avoid risks above the threshold, specify
[0, 0, 0, 0, 0, 0, 0, 0, 9999, 9999, 9999].- Meaning of the above specification: Risks 0 to 7 are safe for traffic. Risks 8 to 10 are 10000 times longer than normal (virtually impassable).
- The range that can be specified for start_lonlat, end_lonlat, and via depends on the map data. If the range is out of the range covered by the map, route search cannot be performed.
- The possible values for map depend on the map data. If it is not necessary, it is recommended to leave it unspecified.
Output samples
{
"jsonrpc": "2.0",
"result": {
"kml": "<?xml ....",
"geojson": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[139.632911226, 35.457119237],
[139.631598771, 35.458785682]
]
},
"properties": {
"edge_id": 240255,
"length": 219.95193,
"speed": 30,
"risk": 3,
"waypoint": false,
"notes": []
}
},
...
]
},
"length": 6090.416765900001,
"time": 0.18572096683666667,
"total_cost": 525.1314270966666,
"max_risk": 3,
"avr_risk": 1.8275290401567656,
"start_node": 186048,
"end_node": 185990
},
"id": "routing_dijkstra"
}
Return values
Returns a JSON object containing information such as route geometry and estimated travel time.
| Key | Data type | Content |
|---|---|---|
| kml | string | KML format route (only if with_kml: true) |
| geojson | object (GeoJSON) | GeoJSON format route |
| length | number | Total distance of the route (m) |
| time | number | Estimated time required (hours) |
| total_cost | number | Sum of “cost * distance” on route |
| max_risk | number | Maximum risk on pathway |
| avr_risk | number | Average risk on route (distance prorated) |
| start_node | number | Node ID near the starting point |
| end_node | number | Node ID near destination |
result.geojson
The value of result.geojson is a GeoJSON object of type FeatureCollection.
The value of result.geojson is a GeoJSON object of the FeatureCollection type.
The geometry object of each feature is a LineString representing the route information. The unit of the route represented by a LineString depends on the map data. Coordinates are two or more points, but not necessarily two points.
result.geojson.features[].properties
The properties of each feature should include the following information
| キー | データ型 | 説明 |
|---|---|---|
| edge_id | number | Edge ID |
| length | number | Path length (m) |
| speed | number | Regulated speed (km/h) |
| risk | number | Risk on route |
| waypoint | boolean | True if the end of the route is a destination or transit point |
| notes | array of string | Note information on the route (e.g., conditional restrictions) |
Description
Outputs a route from the starting point (start_lonlat) to the destination (goal_lonlat) via a transit point (via).
The route is output considering the risk on the route at the starting date and time (start_datetime) and avoiding the risk.
If the request parameter reorder_waypoints is set to true, then the destinations are reordered to minimize the overall cost (i.e., the time required to get there, taking into account risk aversion).
If reorder_waypoints is not specified, or false is specified, the waypoints are followed in the specified order.