Skip to main content

Geo functions

geospatialPathScheme

Commentary

added in 0.1.0

stateful function

Deprecated: See waypoints instead.

Generates a map of distance, time, stepSize, points indicating how to travel between src and dst. distance is kilometers, time is in hours.

stepSize is the distance to travel in each iteration of the geospatialPath function.

points is the number of iterations it will take to travel between src and dst, and can be used to stop the generator after completing the route.

Optionally, scale may be provided to increase or decrease the step size. Higher values yield coarser steps. The default is 1.

Optionally, unit may be provided to select degrees or radians. Default is radians.


Examples

Generating path plans

{
"_gen": "geospatialPathScheme",
"src": {
"_gen": "var",
"var": "src"
},
"dst": {
"_gen": "var",
"var": "dst"
},
"speed": 500,
"scale": 1,
"unit": "degrees"
}
[
{
"distance": 434.2666417299841,
"time": 0.8685332834599682,
"stepSize": 0.002304147465437788,
"points": 435
}
]

Specification

JSON schema

{
"type": "object",
"properties": {
"src": {
"oneOf": [
{
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "number"
}
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
},
"dst": {
"oneOf": [
{
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "number"
}
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
},
"speed": {
"oneOf": [
{
"type": "number",
"minimum": 0
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
},
"scale": {
"type": "number",
"minimum": 0.000001
},
"unit": {
"type": "string",
"enum": [
"degrees",
"radians"
]
}
},
"required": [
"src",
"dst",
"speed"
]
}