docs

    Spatial Queries

    Find features near a point or within a radius.

    Point query

    request
    GET https://api.chrt.co/v1/query?point={lng},{lat}&radius={meters}&layer={layer}
    x-api-key: YOUR_API_KEY

    Parameters

    ParamTypeRequiredDescription
    pointstringYesLongitude,latitude of search center
    radiusnumberNoSearch radius in meters (default 500, max 50,000)
    layerstringNoFilter by S-57 object class. Comma-separated for multiple.
    limitintegerNoMax results (default 50, max 500)

    Response

    Returns a GeoJSON FeatureCollection sorted by distance from the query point. Each feature includes a distance_m property.

    response.json
    {
      "type": "FeatureCollection",
      "query": {
        "point": [-70.865, 42.023],
        "radius_m": 2000
      },
      "features": [
        {
          "type": "Feature",
          "geometry": { "type": "Point", "coordinates": [-70.865, 42.023] },
          "properties": {
            "layer": "LIGHTS",
            "COLOUR": "W",
            "SIGPER": 6,
            "OBJNAM": "Boston Light",
            "cell_id": "US5MA11M",
            "distance_m": 42.7
          }
        },
        {
          "type": "Feature",
          "geometry": { "type": "Point", "coordinates": [-70.861, 42.019] },
          "properties": {
            "layer": "BOYCAR",
            "COLOUR": "R,W",
            "OBJNAM": "Channel Marker 4",
            "cell_id": "US5MA11M",
            "distance_m": 523.1
          }
        }
      ],
      "total_count": 2,
      "limit": 50
    }

    Response fields

    FieldTypeDescription
    queryobjectEcho of the query parameters used
    features[].properties.distance_mnumberDistance from query point in meters
    features[].properties.layerstringS-57 object class name
    features[].properties.cell_idstringSource ENC cell identifier
    total_countintegerTotal features matching the query

    Error responses

    400-bad-request.json
    {
      "error": "bad_request",
      "message": "Invalid point parameter. Expected format: longitude,latitude",
      "details": { "param": "point", "received": "invalid" }
    }
    Find buoys near a position
    curl
    curl "https://api.chrt.co/v1/query?point=-70.86,42.02&radius=2000&layer=BOYCAR,BOYLAT" \
      -H "x-api-key: YOUR_API_KEY"
    response
    {
      "type": "FeatureCollection",
      "query": { "point": [-70.86, 42.02], "radius_m": 2000 },
      "features": [
        {
          "type": "Feature",
          "geometry": { "type": "Point", "coordinates": [-70.858, 42.018] },
          "properties": {
            "layer": "BOYCAR",
            "COLOUR": "R,W",
            "distance_m": 284.3,
            "cell_id": "US5MA11M"
          }
        }
      ],
      "total_count": 1,
      "limit": 50
    }

    Fan-ahead query

    What's charted ahead of you, on your current heading.

    A point-radius query answers "what's around me". Underway, the question is narrower: what's in front of the boat. Give a position, a bearing in degrees true (a craft's COG/heading, or any fixed direction), an arc and a range, and CHRT returns the significant charted features in that sector — sorted by distance, each carrying its bearing and its depth relative to yours.

    It's built for the case where there's a heading but no plan: no route required.

    request
    GET https://api.chrt.co/v1/query/ahead?point={lng},{lat}&bearing={deg}&arc={deg}&range={m}&safety_depth={m}
    x-api-key: YOUR_API_KEY

    Parameters

    ParamTypeRequiredDescription
    pointstringYesLongitude,latitude of the craft or origin
    bearingnumberYesDegrees true (0–360). Values outside the range are normalised, so a heading that wraps past north is fine.
    arcnumberNoFull sector width in degrees, centred on bearing (default 90) — so arc=60 sweeps 30° either side. arc=360 searches all directions.
    rangenumberNoHow far ahead, in metres (default 5,000, max 50,000). 1 nautical mile = 1,852 m.
    safety_depthnumberNoYour safety depth in metres — typically draft plus a margin. Omits water known to be deeper than this. Features with no charted depth are always kept.
    layerstringNoS-57 object classes, comma-separated. Defaults to the significant-feature set below.
    limitintegerNoMax results (default 50, max 500)

    What counts as "significant"

    Without a layer filter, the fan returns the classes that can hit a hull — S-52 viewing group 24020 (WRECKS, OBSTRN, UWTROC, RAPIDS, WATTUR, FSHFAC, OILBAR, NEWOBJ) plus the depth-carrying classes (DEPARE, DRGARE, SOUNDG). Land and administrative areas are excluded. Pass layer for a different set, or use the point query for an unfiltered search.

    Response fields

    A GeoJSON FeatureCollection sorted by distance. Each feature adds:

    FieldDescription
    distance_mMetres to the nearest point of the feature
    bearing_degDegrees true to its nearest point. null if you're inside the feature (e.g. within a depth area). May fall outside your requested arc — a large polygon can clip the sector edge while its nearest point bears outside it.
    least_depth_mLeast charted depth (VALSOU / DEPTH / DRVAL1), or null if unknown
    depth_clearance_mleast_depth_m − safety_depth. Negative means shallower than you declared safe.

    The response also carries a coverage block — covered, covered_fraction, and the ENC cells under the sector with their edition, update number and issue date — plus attribution, disclaimer and notice. Read the next section before you use any of it.

    An empty result is not an all-clear

    This endpoint tells you what CHRT has charted in a sector. It does not tell you whether that sector is safe, and it never will — that's a navigation-grade claim, and CHRT is situational awareness only, not an ECDIS.

    Zero features can mean nothing is charted there, or that CHRT has no coverage there at all. Those are different answers and only one of them is about the sea. Always check coverage.covered before showing a user anything, and say plainly when a sector is uncovered.

    You'll notice there's no severity or risk score. That's deliberate. You get facts that sort — distance, bearing, depth clearance — and your application owns the judgment about what they mean for your vessel.

    Setting the safety depth once

    Rather than passing safety_depth on every call, the SDK lets you state it once as a vessel profile — the query then filters at it, and the generated style shades soundings and draws danger rings at the same number. An explicit per-call value still wins.

    vessel.ts
    const chrt = new Chrt({ apiKey, vessel: { safetyDepthM: 3 } });
    
    await chrt.ahead({ point, bearing });   // filters at 3 m
    chrt.style();                           // labels + danger rings at 3 m

    It is client-side and per-instance, deliberately — not attached to your API key. A consumer app has one key and many skippers with different boats, so construct a Chrt per user. With no profile CHRT sends no depth at all rather than guessing a draft.

    Choosing a range and arc

    There's no speed parameter, on purpose: turning speed-over-ground into a lookahead distance is a navigational judgment, and it belongs to you. The usual recipe isrange = SOG × lookahead_time — a fast craft wants a longer, narrower fan; a slow one a shorter, wider one.

    Re-fan on meaningful change, not on a timer: when the course shifts by more than a few degrees, or when you've run a decent fraction of your range. A sharp turn should force an immediate re-fan on the new heading — the old one describes water you're no longer heading for. Polling every second bills you for answers that haven't changed.

    sdk
    import { Chrt } from '@chrtco/sdk';
    const chrt = new Chrt('YOUR_API_KEY');
    
    const fan = await chrt.ahead({
      point: [-70.9245, 42.33604],
      bearing: gps.cog,   // degrees true
      arc: 60,            // full width, so ±30°
      rangeNm: 3,
      safetyDepth: 3,     // your draft plus a margin
    });
    
    if (!fan.coverage.covered) {
      // No ENC data here. Say so — do not report "clear".
    }
    
    for (const f of fan.features) {
      const { distance_m, bearing_deg, depth_clearance_m } = f.properties;
      // Your alert policy, your thresholds.
    }
    What's ahead on this heading
    curl
    curl "https://api.chrt.co/v1/query/ahead?point=-70.9245,42.33604&bearing=270&arc=60&range=5000&safety_depth=3" \
      -H "x-api-key: YOUR_API_KEY"
    response
    {
      "type": "FeatureCollection",
      "query": {
        "point": [-70.9245, 42.33604],
        "bearing_deg": 270, "arc_deg": 60, "range_m": 5000,
        "safety_depth_m": 3
      },
      "features": [
        {
          "type": "Feature",
          "geometry": { "type": "Point", "coordinates": [-70.95, 42.336] },
          "properties": {
            "layer": "WRECKS",
            "cell_id": "US5MA11M",
            "distance_m": 412.7,
            "bearing_deg": 268.4,
            "least_depth_m": 2.1,
            "depth_clearance_m": -0.9
          }
        }
      ],
      "total_count": 1,
      "limit": 50,
      "coverage": {
        "covered": true,
        "covered_fraction": 1.0,
        "cells": [
          {
            "cell_id": "US5MA11M",
            "title": "Boston Inner Harbor",
            "chart_source": "NOAA",
            "edition": 24, "update_number": 7, "issue_date": "2026-05-14"
          }
        ]
      },
      "attribution": "Chart data from official ENCs issued by: NOAA. ...",
      "disclaimer": "CHRT provides official ENC data for situational awareness only. ...",
      "notice": "This response lists what CHRT has charted in the requested sector. It is not a safety assessment and an empty result is NOT an all-clear ..."
    }

    Along-route query

    What's charted along a passage.

    The passage-planning sibling of the fan. Same question — what might I hit? — but the geometry is a corridor either side of a route rather than a sector ahead of a point. Results come back ordered by how far into the passage you meet them, which is the order you actually encounter them in.

    This doesn't replace the fan, and the fan doesn't replace it. A boat with a route still drifts, and course-over-ground rarely equals the route bearing — so a passage app wants both: this once per route edit, the fan continuously against the real track.

    request
    GET https://api.chrt.co/v1/query/route?route={geojson}&buffer={m}&safety_depth={m}
    x-api-key: YOUR_API_KEY

    Parameters

    ParamTypeRequiredDescription
    routeGeoJSONYesA GeoJSON LineString of at least 2 waypoints. A bare [[lng,lat],…] array is accepted too.
    buffernumberNoCorridor half-width in metres either side of the track (default 500, max 50,000)
    safety_depthnumberNoYour safety depth in metres. Omits water known to be deeper. Features with no charted depth are always kept.
    layerstringNoS-57 classes, comma-separated. Defaults to the significant-feature set.
    limitintegerNoMax features (default 100, max 500)
    offsetintegerNoPagination offset (default 0)

    Response fields

    A GeoJSON FeatureCollection ordered by progress along the route. Each feature adds:

    FieldDescription
    along_mMetres along the route to the point of closest approach — how far into the passage you meet this. Drives the ordering.
    distance_mMetres from the track to the nearest point of the feature
    least_depth_mLeast charted depth, or null if unknown
    depth_clearance_mNegative means shallower than you declared safe.

    As with the fan, the response carries a coverage block plusattribution, disclaimer and notice.An empty result is not a clear passage — it may mean CHRT holds no chart for it. Check coverage.covered first, and note there is no severity or risk score here either, for the same reason.

    sdk
    const passage = await chrt.alongRoute({
      route: [[-70.95, 42.33], [-71.0, 42.35], [-71.02, 42.36]],
      bufferNm: 0.5,
      safetyDepth: 3,
    });
    
    if (!passage.coverage.covered) {
      // CHRT holds no chart here — say so; do not report it as clear.
    }
    
    for (const f of passage.features) {
      const { along_m, distance_m, depth_clearance_m } = f.properties;
    }
    
    // Or iterate every feature, auto-paginating:
    for await (const f of chrt.alongRouteIter({ route, bufferNm: 0.5 })) { /* … */ }

    Coverage for a route

    Which charts you need for a passage.

    A different question, and deliberately a different endpoint: this returns ENC cells, not features. It answers "which charts must I hold for this passage?" — the natural companion of CHRToffline — rather than "what might I hit?". That's why it lives under /v1/coverageand not /v1/query.

    request
    GET https://api.chrt.co/v1/coverage/route?route={geojson}&buffer={m}&scale_band={band}
    x-api-key: YOUR_API_KEY

    Parameters

    ParamTypeRequiredDescription
    routeGeoJSONYesA GeoJSON LineString of at least 2 waypoints
    buffernumberNoCorridor half-width in metres (default 1000, max 50,000)
    scale_bandstringNoRestrict to one band, e.g. Harbor for harbour cells. Case-sensitive: Overview | General | Coastal | Approach | Harbor
    limitintegerNoMax cells (default 100, max 500)

    Cells come back largest scale first — where an overview and a harbour cell both cover the same water, S-57 says believe the more detailed one. Each carries its edition, update_number andissue_date, so you can tell whether the copy you already hold is stale.

    sdk
    const { cells } = await chrt.coverage.forRoute({
      route: [[-70.95, 42.33], [-71.0, 42.35]],
      bufferNm: 1,
    });
    
    for (const c of cells) {
      console.log(c.cell_id, c.edition, c.update_number, c.issue_date);
    }

    An empty cell list means CHRT holds no chart for this passage. That's a reason to stop and check official charts — never a sign the passage is clear.

    For situational awareness only — not for primary navigation. CHRT is not an ECDIS and is not SOLAS-compliant.

    CHRT uses only the cookies and local storage the site needs to work — keeping you signed in, remembering your preferences, and protecting the forms. There is no analytics, no advertising and no cross-site tracking, so there is nothing here to opt out of. Privacy Policy