Route tool
The RouteTool, which an agent sees as FindRoute, finds a path between two nodes on an indexed network — roads, pipes, cables, corridors.
The cost is an integral field (long, integer, short, or byte) on the edges, so the same graph answers "shortest", "fastest", and "cheapest" depending on which field you pass. The answer names that field next to the total, so the unit stays the unit in your data. from and to are node ids already in the network. Build the graph with _graph/build before the first route (see the routing page).
When the graph has no path from from to to, the answer states that and repeats the nodes that were asked for.
Build the network first. See Road routing and network traversal.
Parameters
| Parameter | Required | Description |
|---|---|---|
index | Yes | The index holding the network. |
field | Yes | The graph_edge field. |
weight_field | Yes | The numeric field holding each edge's cost. |
from | Yes | The node id to start from. |
to | Yes | The node id to reach. |
Up to 50 nodes of the route are listed; longer routes are summarised.
Register a flow agent that runs the RouteTool
POST /_plugins/_agent/agents/_register
{
"name": "Routing_Agent",
"type": "flow",
"description": "finds a route on the road network",
"tools": [
{
"type": "RouteTool",
"name": "DemoFindRoute",
"parameters": {
"index": "roads",
"field": "road",
"weight_field": "seconds"
}
}
]
}
POST /_plugins/_ml/agents/<agent_id>/_execute
{
"parameters": { "from": "1001", "to": "4482" }
}
Related tools
- Where things are now:
FindFeatures - The path something already took:
FindTracks