Skip to content

Route searching - routing.dijkstra

This document has been machine translated.

Searches for a safe and short route based on risks for the specified risk map(s) at the specified date and time.

JSON-RPC v2.0 is used as the execution method.

Sample Request


{
  "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"
}

Parameter


Parameter Name Data Type Details 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 ending point Required
start_datetime string Date and Time ("YYYY-MM-DD hh:mm:ss+TZ") Required
via array of array of number Longitude and latitude of transit location [] (no transit location)
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

Classification Data Type Details
Key string Theme name of riskmap
Value array of number risk sensitivity

Remarks and Restrictions

  • If you do not consider risk, specify an empty object ({}) in 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 Sample

{
  "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 Details
kml string KML format route (only if with_kml: true)
geojson object (GeoJSON) GeoJSON formatted route
length number Total distance of the route (m)
time number Estimated time required (hours)
total_cost number Sum of "cost * distance" on the route
max_risk number Maximum risk on the route
avr_risk number Average risk on the route (proportional to distance)
start_node number Node IDs near the starting point
end_node number Node IDs near the destination point

result.geojson

The value of result.geojson should be a GeoJSON object of the FeatureCollection type.

result.geojson.features[].geometry

The geometry object of each feature is route information expressed as a LineString. 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.

Key Data Type Details
edge_id number Edge ID
length number Path length (m)
speed number Regulated speed (km/h)
risk number Risk on the route
waypoint boolean If the end of the route is a destination or transit point, true
notes array of string Note information on the route (e.g. conditional restriction information)

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.