Shortest path on a road-graph snapshot (SP7)
curl --request POST \
--url https://api.eddy.engineer/v1/spatial.route \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"goal": {
"lat": 123,
"lon": 123
},
"roadgraph": "<string>",
"start": {
"lat": 123,
"lon": 123
},
"rule": {
"allow_highway": [
"<string>"
],
"avoid": [
[
"<string>"
]
],
"default_speed_kmh": 123,
"max_speed_kmh": 123,
"respect_oneway": true
}
}
'import requests
url = "https://api.eddy.engineer/v1/spatial.route"
payload = {
"goal": {
"lat": 123,
"lon": 123
},
"roadgraph": "<string>",
"start": {
"lat": 123,
"lon": 123
},
"rule": {
"allow_highway": ["<string>"],
"avoid": [["<string>"]],
"default_speed_kmh": 123,
"max_speed_kmh": 123,
"respect_oneway": True
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
goal: {lat: 123, lon: 123},
roadgraph: '<string>',
start: {lat: 123, lon: 123},
rule: {
allow_highway: ['<string>'],
avoid: [['<string>']],
default_speed_kmh: 123,
max_speed_kmh: 123,
respect_oneway: true
}
})
};
fetch('https://api.eddy.engineer/v1/spatial.route', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/spatial.route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'goal' => [
'lat' => 123,
'lon' => 123
],
'roadgraph' => '<string>',
'start' => [
'lat' => 123,
'lon' => 123
],
'rule' => [
'allow_highway' => [
'<string>'
],
'avoid' => [
[
'<string>'
]
],
'default_speed_kmh' => 123,
'max_speed_kmh' => 123,
'respect_oneway' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/spatial.route"
payload := strings.NewReader("{\n \"goal\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"roadgraph\": \"<string>\",\n \"start\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"rule\": {\n \"allow_highway\": [\n \"<string>\"\n ],\n \"avoid\": [\n [\n \"<string>\"\n ]\n ],\n \"default_speed_kmh\": 123,\n \"max_speed_kmh\": 123,\n \"respect_oneway\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/spatial.route")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"goal\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"roadgraph\": \"<string>\",\n \"start\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"rule\": {\n \"allow_highway\": [\n \"<string>\"\n ],\n \"avoid\": [\n [\n \"<string>\"\n ]\n ],\n \"default_speed_kmh\": 123,\n \"max_speed_kmh\": 123,\n \"respect_oneway\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/spatial.route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"goal\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"roadgraph\": \"<string>\",\n \"start\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"rule\": {\n \"allow_highway\": [\n \"<string>\"\n ],\n \"avoid\": [\n [\n \"<string>\"\n ]\n ],\n \"default_speed_kmh\": 123,\n \"max_speed_kmh\": 123,\n \"respect_oneway\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"coordinates": [
[
123
]
],
"cost": 123,
"expanded": 123,
"geometry": {},
"length_m": 123,
"method": "<string>",
"nodes": [
123
],
"roadgraph_key": "<string>",
"rule": {
"algorithm": "a_star",
"allow_highway": [
"<string>"
],
"avoid": [
[
"<string>"
]
],
"default_speed_kmh": 123,
"max_speed_kmh": 123,
"metric": "length",
"respect_oneway": true
},
"snap_goal_m": 123,
"snap_start_m": 123,
"snapshot": {},
"time_s": 123,
"ways": [
123
]
}Maps
Shortest path on a road-graph snapshot (SP7)
Dijkstra or A* (the geodesic-chord heuristic, admissible) on a road graph derived from an OSM snapshot, under a stated `rule`: `metric` length (default) or time (speeds from the `maxspeed` tag — a number, `NN mph`, `NN km/h` — with `default_speed_kmh` where the tag is missing or unusable, capped at `max_speed_kmh`), `respect_oneway` (default true), tag=value pairs to `avoid`, `allow_highway` classes; SP7.b: `respect_restrictions` (default true) honours the snapshot's turn restrictions (OSM `type=restriction` relations via a node — `no_*` forbids that turn, `only_*` every other) through an edge-state search, and `departure` (unix seconds) with a `speed_profile` ([{start_hour, end_hour, factor, highway?}], UTC hours, a window ending before it starts wraps midnight) makes the time metric read each edge's speed at the instant it is entered (the answer carries `arrival` and `restrictions_applied`). Nothing road-specific lives in the engine: the rules are the snapshot's tags as the connector kept them, and the rule the caller chose is echoed. Start and goal snap to the nearest graph node by ECEF chord (the distances stated). Answers the node ids, the ways taken, the coordinates as a LineString, length, time, cost, the nodes expanded, and the snapshot's provenance. No path → ROUTE_UNREACHABLE.
POST
/
v1
/
spatial.route
Shortest path on a road-graph snapshot (SP7)
curl --request POST \
--url https://api.eddy.engineer/v1/spatial.route \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"goal": {
"lat": 123,
"lon": 123
},
"roadgraph": "<string>",
"start": {
"lat": 123,
"lon": 123
},
"rule": {
"allow_highway": [
"<string>"
],
"avoid": [
[
"<string>"
]
],
"default_speed_kmh": 123,
"max_speed_kmh": 123,
"respect_oneway": true
}
}
'import requests
url = "https://api.eddy.engineer/v1/spatial.route"
payload = {
"goal": {
"lat": 123,
"lon": 123
},
"roadgraph": "<string>",
"start": {
"lat": 123,
"lon": 123
},
"rule": {
"allow_highway": ["<string>"],
"avoid": [["<string>"]],
"default_speed_kmh": 123,
"max_speed_kmh": 123,
"respect_oneway": True
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
goal: {lat: 123, lon: 123},
roadgraph: '<string>',
start: {lat: 123, lon: 123},
rule: {
allow_highway: ['<string>'],
avoid: [['<string>']],
default_speed_kmh: 123,
max_speed_kmh: 123,
respect_oneway: true
}
})
};
fetch('https://api.eddy.engineer/v1/spatial.route', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/spatial.route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'goal' => [
'lat' => 123,
'lon' => 123
],
'roadgraph' => '<string>',
'start' => [
'lat' => 123,
'lon' => 123
],
'rule' => [
'allow_highway' => [
'<string>'
],
'avoid' => [
[
'<string>'
]
],
'default_speed_kmh' => 123,
'max_speed_kmh' => 123,
'respect_oneway' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/spatial.route"
payload := strings.NewReader("{\n \"goal\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"roadgraph\": \"<string>\",\n \"start\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"rule\": {\n \"allow_highway\": [\n \"<string>\"\n ],\n \"avoid\": [\n [\n \"<string>\"\n ]\n ],\n \"default_speed_kmh\": 123,\n \"max_speed_kmh\": 123,\n \"respect_oneway\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/spatial.route")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"goal\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"roadgraph\": \"<string>\",\n \"start\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"rule\": {\n \"allow_highway\": [\n \"<string>\"\n ],\n \"avoid\": [\n [\n \"<string>\"\n ]\n ],\n \"default_speed_kmh\": 123,\n \"max_speed_kmh\": 123,\n \"respect_oneway\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/spatial.route")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"goal\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"roadgraph\": \"<string>\",\n \"start\": {\n \"lat\": 123,\n \"lon\": 123\n },\n \"rule\": {\n \"allow_highway\": [\n \"<string>\"\n ],\n \"avoid\": [\n [\n \"<string>\"\n ]\n ],\n \"default_speed_kmh\": 123,\n \"max_speed_kmh\": 123,\n \"respect_oneway\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"coordinates": [
[
123
]
],
"cost": 123,
"expanded": 123,
"geometry": {},
"length_m": 123,
"method": "<string>",
"nodes": [
123
],
"roadgraph_key": "<string>",
"rule": {
"algorithm": "a_star",
"allow_highway": [
"<string>"
],
"avoid": [
[
"<string>"
]
],
"default_speed_kmh": 123,
"max_speed_kmh": 123,
"metric": "length",
"respect_oneway": true
},
"snap_goal_m": 123,
"snap_start_m": 123,
"snapshot": {},
"time_s": 123,
"ways": [
123
]
}Body
application/json