A cost surface ss.spatial.cost/1 from layers: rasterise, align, reclassify, weight, barriers (TP14)
curl --request POST \
--url https://api.eddy.engineer/v1/spatial.cost \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"spec": {},
"template_key": "<string>"
}
'import requests
url = "https://api.eddy.engineer/v1/spatial.cost"
payload = {
"spec": {},
"template_key": "<string>"
}
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({spec: {}, template_key: '<string>'})
};
fetch('https://api.eddy.engineer/v1/spatial.cost', 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.cost",
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([
'spec' => [
],
'template_key' => '<string>'
]),
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.cost"
payload := strings.NewReader("{\n \"spec\": {},\n \"template_key\": \"<string>\"\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.cost")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"spec\": {},\n \"template_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/spatial.cost")
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 \"spec\": {},\n \"template_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}Maps
A cost surface ss.spatial.cost/1 from layers: rasterise, align, reclassify, weight, barriers (TP14)
TP14: the cost per metre of route on a grid (`spec.grid`, or `template_key`'s) from `spec.layers` in order: each a stored raster (on the grid, or sampled at the cell centres by its stated `resample`: nearest, bilinear, bicubic) or a stored vector document rasterised by its rule; optionally reclassified (`ranges` from <= v < to, or exact `classes`, each to a number, `keep` or `block`, with a required `otherwise`); a cost layer adds weight x value to `spec.base`, a barrier layer blocks where its value is `block` or not zero; holes follow the layer's `nodata` (default block for cost, free for a barrier). A negative cost refuses naming the cell unless `min_cost` clamps it. Stores the cost raster (quantity `cost`, `spec.unit` such as AUD/m) and the document (the grid and its metre scale, each layer with its source's content key and counts, blocked cells, the method). Refusals: COST_SPEC, COST_SOURCE, COST_FRAME, COST_GRID, COST_NEGATIVE, COST_VALUE, RECLASS, RASTERIZE. Refusals are typed (`{error: {code, message}}`): `INPUT` (400), `NOT_FOUND` (404), and the engine's own codes (400).
POST
/
v1
/
spatial.cost
A cost surface ss.spatial.cost/1 from layers: rasterise, align, reclassify, weight, barriers (TP14)
curl --request POST \
--url https://api.eddy.engineer/v1/spatial.cost \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"spec": {},
"template_key": "<string>"
}
'import requests
url = "https://api.eddy.engineer/v1/spatial.cost"
payload = {
"spec": {},
"template_key": "<string>"
}
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({spec: {}, template_key: '<string>'})
};
fetch('https://api.eddy.engineer/v1/spatial.cost', 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.cost",
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([
'spec' => [
],
'template_key' => '<string>'
]),
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.cost"
payload := strings.NewReader("{\n \"spec\": {},\n \"template_key\": \"<string>\"\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.cost")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"spec\": {},\n \"template_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/spatial.cost")
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 \"spec\": {},\n \"template_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}Body
application/json
Response
See the description
The response is of type object.