Distance Between Coordinates
location.distance_between
Overview
You send two WGS-84 coordinate pairs and we return the geodesic distance plus initial and final compass bearings. Choose vincenty (default, ellipsoidal, most accurate) or haversine (spherical). Distances are rounded numbers in the unit you pick. You must already have coordinates — we don't geocode place names, compute routes, or estimate travel time. Don't use this for driving directions or elevation.
Ask two systems for the distance between the same two points and you get two answers, because each picked its own Earth radius and rounding. We pin the ellipsoid, publish the rounding, and hand back the bearings as well.
Reliability
Same coordinates, same answer — no clock, no network, no lookup table. This is distance across the surface, ignoring elevation, roads and obstacles. In a batch the first bad leg stops the whole call, so you get one failure rather than a half-filled results array. COORDINATE_INVALID — trigger: a latitude or longitude that is missing, sent as a string, or not a finite number; retryable: no, the same payload always fails; next: send both values as JSON numbers in decimal degrees, converting any degrees-minutes-seconds on your side first. COORDINATE_OUT_OF_RANGE — trigger: a latitude outside -90 to 90 or a longitude outside -180 to 180, which usually means the two are swapped; retryable: no; next: check the order — latitude first, then longitude — and re-send. DISTANCE_UNIT_UNSUPPORTED — trigger: a unit that is not m, km, mi or nmi, such as feet or yards; retryable: no; next: pick one of the four and convert afterwards if you need another. DISTANCE_METHOD_UNSUPPORTED — trigger: a method that is not vincenty or haversine; retryable: no; next: use vincenty for accuracy or haversine for a spherical estimate. DISTANCE_BATCH_LIMIT_EXCEEDED — trigger: your pairs array holds more than 500 legs; retryable: no; next: split the batch into chunks of 500 or fewer, keeping the same unit and method so the results stay comparable.
Context footprint
Send one pair or up to 500 pairs in a batch. A successful call costs 1 execution credit.
When to use it
When both ends are already latitude and longitude, and you want a straight-line distance you can reproduce and defend.
When you still need to turn an address into coordinates, or you want driving distance, travel time or anything that follows roads.
Scope
Non-goals
- No routing or travel-time calculation
- No geocoding of place names or addresses
- No elevation or 3D distance
- No map projection or tile math
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| from | object | No | Starting WGS-84 point with latitude from -90 through 90 and longitude from -180 through 180 as JSON numbers. Required unless pairs is provided. |
| to | object | No | Ending WGS-84 point with the same latitude and longitude number bounds as from. Required unless pairs is provided. |
| pairs | array | No | Up to 500 closed legs; omit it to measure the single from-to pair. When both are sent, pairs wins. |
| unit | string | No | Distance unit; omit it for km. |
| method | string | No | Geodesic formula; omit it for vincenty. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| distance | number | No | Single-leg rounded distance; omitted when results carries a batch of two or more legs. |
| unit | string | Yes | Unit the published distance is expressed in, km when you omitted it. |
| method | string | Yes | Formula the published figure came from, vincenty when you omitted it. |
| initialBearing | number | No | Single-leg departure heading; omitted on a multi-leg batch. |
| finalBearing | number | No | Single-leg arrival heading; omitted on a multi-leg batch. |
| from | object | No | Single-leg origin actually used; omitted on a multi-leg batch. |
| to | object | No | Single-leg destination actually used; omitted on a multi-leg batch. |
| converged | boolean | No | Single-leg convergence flag; omitted on a multi-leg batch. |
| id | string | No | Single-leg id; omitted when you did not supply one. |
| results | array | No | Present only for two or more pairs: one full single-pair answer per leg in input order. |
| _meta | object | No | How the figure was produced: the reference ellipsoid name and a published precision marker, plus an optional path when Vincenty publishes one. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"location.distance_between","input":{"from":{"latitude":50.8503,"longitude":4.3517},"to":{"latitude":48.8566,"longitude":2.3522},"unit":"km"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("location.distance_between", {"unit":"km","method":"vincenty","from":{"latitude":50.8503,"longitude":4.3517},"to":{"latitude":48.8566,"longitude":2.3522}});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| COORDINATE_OUT_OF_RANGE | 400 | No | The request payload failed this skill's input validation. |
| COORDINATE_INVALID | 400 | No | The request payload failed this skill's input validation. |
| DISTANCE_UNIT_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| DISTANCE_METHOD_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| DISTANCE_BATCH_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- No routing or travel-time calculation
- No geocoding of place names or addresses
- No elevation or 3D distance
- No map projection or tile math
- Turning a city name into coordinates first
- Driving, walking, or transit directions
- Altitude-aware or tunnel-aware distance
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "location.distance_between",
"input": {
"unit": "km",
"method": "vincenty",
"from": {
"latitude": 50.8503,
"longitude": 4.3517
},
"to": {
"latitude": 48.8566,
"longitude": 2.3522
}
}
}Examples
Warehouse in Brussels to a depot in Paris — ellipsoidal distance in km
{
"unit": "km",
"method": "vincenty",
"from": {
"latitude": 50.8503,
"longitude": 4.3517
},
"to": {
"latitude": 48.8566,
"longitude": 2.3522
}
}{
"distance": 264.3,
"unit": "km",
"converged": true,
"method": "vincenty",
"initialBearing": 213.7,
"to": {
"latitude": 48.8566,
"longitude": 2.3522
},
"_meta": {
"precision": "1e-9",
"ellipsoid": "WGS-84"
},
"finalBearing": 212.2,
"from": {
"latitude": 50.8503,
"longitude": 4.3517
}
}NYC to Los Angeles great-circle estimate in miles with haversine
{
"unit": "mi",
"method": "haversine",
"from": {
"longitude": -74.006,
"latitude": 40.7128
},
"to": {
"longitude": -118.2437,
"latitude": 34.0522
}
}{
"distance": 2445.6,
"unit": "mi",
"converged": true,
"method": "haversine",
"initialBearing": 273.7,
"to": {
"longitude": -118.2437,
"latitude": 34.0522
},
"_meta": {
"precision": "1e-9",
"ellipsoid": "WGS-84"
},
"finalBearing": 245.9,
"from": {
"longitude": -74.006,
"latitude": 40.7128
}
}Same point twice — zero distance and neutral bearings
{
"unit": "km",
"method": "vincenty",
"from": {
"longitude": -74,
"latitude": 40
},
"to": {
"longitude": -74,
"latitude": 40
}
}{
"distance": 0,
"unit": "km",
"converged": true,
"method": "vincenty",
"initialBearing": 0,
"to": {
"longitude": -74,
"latitude": 40
},
"_meta": {
"precision": "1e-9",
"ellipsoid": "WGS-84"
},
"finalBearing": 0,
"from": {
"longitude": -74,
"latitude": 40
}
}Two delivery legs in one batch, each tagged with your own id
{
"pairs": [
{
"from": {
"latitude": 50.8503,
"longitude": 4.3517
},
"to": {
"latitude": 48.8566,
"longitude": 2.3522
},
"id": "bru-par"
},
{
"from": {
"longitude": 4.9041,
"latitude": 52.3676
},
"to": {
"longitude": 4.4777,
"latitude": 51.9244
},
"id": "ams-rtm"
}
],
"unit": "km",
"method": "vincenty"
}{
"unit": "km",
"_meta": {
"precision": "1e-9",
"ellipsoid": "WGS-84"
},
"results": [
{
"distance": 264.3,
"unit": "km",
"method": "vincenty",
"initialBearing": 213.7,
"finalBearing": 212.2,
"from": {
"latitude": 50.8503,
"longitude": 4.3517
},
"to": {
"latitude": 48.8566,
"longitude": 2.3522
},
"converged": true,
"_meta": {
"precision": "1e-9",
"ellipsoid": "WGS-84"
},
"id": "bru-par"
},
{
"distance": 57.3,
"unit": "km",
"method": "vincenty",
"initialBearing": 210.8,
"finalBearing": 210.5,
"from": {
"longitude": 4.9041,
"latitude": 52.3676
},
"to": {
"longitude": 4.4777,
"latitude": 51.9244
},
"converged": true,
"id": "ams-rtm",
"_meta": {
"precision": "1e-9",
"ellipsoid": "WGS-84"
}
}
],
"method": "vincenty"
}Recommended use cases
- Measure straight-line distance between two known GPS points
- Compare haversine vs vincenty when you need a quick spherical estimate
- Batch distance checks for many coordinate pairs in one call
Avoid for
- Turning a city name into coordinates first
- Driving, walking, or transit directions
- Altitude-aware or tunnel-aware distance
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.