← All procedures
geo.distance
Give the great-circle distance between two points in kilometres (haversine), without the network. Deprecated: use geo.distanceKm with radiusKm 6371
CLI- Package
- @procedures/geo · README
- Path
["geo","distance"]- CLI
mark geo distance --from <object> --to <object>- As data
{"$proc":["geo","distance"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/geo/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["geo","distance"], { from: {}, to: {} });
console.log(JSON.stringify(result));From the command line
$ mark geo distance --from <object> --to <object>
As data, in a program
{ "$proc": ["geo", "distance"], "input": { "from": {}, "to": {} } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"from": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"lon": {
"type": "number",
"minimum": -180,
"maximum": 180
}
},
"required": [
"lat",
"lon"
],
"description": "The first point (degrees)"
},
"to": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"lon": {
"type": "number",
"minimum": -180,
"maximum": 180
}
},
"required": [
"lat",
"lon"
],
"description": "The second point (degrees)"
}
},
"required": [
"from",
"to"
]
},
"output": {
"type": "object",
"properties": {
"km": {
"type": "number",
"description": "The great-circle distance in kilometres (haversine, Earth radius 6371 km), without rounding"
}
},
"required": [
"km"
],
"additionalProperties": false
}
}