Charter Boats API
Sea Routing

Calculate Sea Route

Get the sailing route between two or more points, navigating around land

Endpoint

GET /searoute/route

Description

Calculates the actual sea route between coordinates, navigating around coastlines and islands. Uses GSHHG coastline data with A* pathfinding for accurate maritime routing.

Supports both simple point-to-point routes and multi-waypoint routes. Long routes are automatically split into segments and stitched together.

Responses are cached for 24 hours.

Authentication

No authentication required. This is a public endpoint.

Query Parameters

Use either from+to or waypoints, not both.

ParameterTypeRequiredDescription
fromstringYes*Origin as longitude,latitude
tostringYes*Destination as longitude,latitude
waypointsstringYes*Multiple points as lon,lat|lon,lat|... (min 2)

* Provide either from+to or waypoints.

Example Requests

Point to Point

curl "https://charter.boats/api/searoute/route?from=20.7114,38.8289&to=20.5897,38.6309"

Multi-Waypoint

curl "https://charter.boats/api/searoute/route?waypoints=20.7114,38.8289|20.5897,38.6309|20.4883,38.4127"

Example Response

{
  "type": "Feature",
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [20.71, 38.83],
      [20.71, 38.825],
      [20.71, 38.81],
      [20.73, 38.75],
      [20.725, 38.68],
      [20.59, 38.63]
    ]
  },
  "properties": {
    "distance_km": 40.8,
    "distance_nm": 22,
    "waypoints": 39,
    "tiles_used": ["20.4_38.6", "20.4_38.8"],
    "total_iterations": 156,
    "compute_ms": 12
  }
}

Returns a GeoJSON Feature with a LineString geometry.

Response Properties

PropertyTypeDescription
distance_kmnumberTotal route distance in kilometers
distance_nmnumberTotal route distance in nautical miles
waypointsnumberNumber of coordinates in the route geometry
tiles_usedstring[]Coastline tiles used for pathfinding
total_iterationsnumberA* algorithm iterations
segmentsnumberNumber of route segments (multi-waypoint only)
fallback_segmentsnumberSegments that used straight-line fallback (if any)
compute_msnumberComputation time in milliseconds
fallbackbooleantrue if straight-line fallback was used (single segment)

Coverage

Currently covers the Ionian Sea (Greece):

  • Longitude: 19°E to 22°E
  • Latitude: 37°N to 40°N
  • Resolution: ~550 meters

Requests outside this region will return an error.

Fallback Behavior

If no sea route can be found (e.g., points are on land or in enclosed bodies of water), the API returns a straight-line route with properties.fallback: true.

Error Responses

400 Bad Request

{
  "statusCode": 400,
  "message": "Invalid waypoints format. Use: waypoints=lon,lat|lon,lat|..."
}

502 Routing Failed

{
  "statusCode": 502,
  "message": "Failed to fetch sea route: ..."
}

On this page