Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Distance Between Coordinates

location.distance_between

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
No network

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

Note
Geodesic distance and bearings between WGS-84 coordinate pairs you provide.

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

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

math

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input64 KB

How we handle your data

Sensitive input, safe output
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
fromobjectNoStarting WGS-84 point with latitude from -90 through 90 and longitude from -180 through 180 as JSON numbers. Required unless pairs is provided.
toobjectNoEnding WGS-84 point with the same latitude and longitude number bounds as from. Required unless pairs is provided.
pairsarrayNoUp to 500 closed legs; omit it to measure the single from-to pair. When both are sent, pairs wins.
unitstringNoDistance unit; omit it for km.
methodstringNoGeodesic formula; omit it for vincenty.

Output schema

FieldTypeRequiredDescription
distancenumberNoSingle-leg rounded distance; omitted when results carries a batch of two or more legs.
unitstringYesUnit the published distance is expressed in, km when you omitted it.
methodstringYesFormula the published figure came from, vincenty when you omitted it.
initialBearingnumberNoSingle-leg departure heading; omitted on a multi-leg batch.
finalBearingnumberNoSingle-leg arrival heading; omitted on a multi-leg batch.
fromobjectNoSingle-leg origin actually used; omitted on a multi-leg batch.
toobjectNoSingle-leg destination actually used; omitted on a multi-leg batch.
convergedbooleanNoSingle-leg convergence flag; omitted on a multi-leg batch.
idstringNoSingle-leg id; omitted when you did not supply one.
resultsarrayNoPresent only for two or more pairs: one full single-pair answer per leg in input order.
_metaobjectNoHow 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/execute
curl
curl -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"}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
COORDINATE_OUT_OF_RANGE400NoThe request payload failed this skill's input validation.
COORDINATE_INVALID400NoThe request payload failed this skill's input validation.
DISTANCE_UNIT_UNSUPPORTED400NoThe skill does not support the requested variant.
DISTANCE_METHOD_UNSUPPORTED400NoThe skill does not support the requested variant.
DISTANCE_BATCH_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "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

Inputjson
{
  "unit": "km",
  "method": "vincenty",
  "from": {
    "latitude": 50.8503,
    "longitude": 4.3517
  },
  "to": {
    "latitude": 48.8566,
    "longitude": 2.3522
  }
}
Expected outputjson
{
  "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

Inputjson
{
  "unit": "mi",
  "method": "haversine",
  "from": {
    "longitude": -74.006,
    "latitude": 40.7128
  },
  "to": {
    "longitude": -118.2437,
    "latitude": 34.0522
  }
}
Expected outputjson
{
  "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

Inputjson
{
  "unit": "km",
  "method": "vincenty",
  "from": {
    "longitude": -74,
    "latitude": 40
  },
  "to": {
    "longitude": -74,
    "latitude": 40
  }
}
Expected outputjson
{
  "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

Inputjson
{
  "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"
}
Expected outputjson
{
  "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"
}
  • 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

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.

Tags

locationdistancemathgeodesic