Feature API
Query individual ENC features with filtering and pagination.
Endpoint
request
GET https://api.chrt.co/v1/features?bbox={west},{south},{east},{north}&layer={layer}&limit={n}
x-api-key: YOUR_API_KEYQuery parameters
| Param | Type | Required | Description |
|---|---|---|---|
bbox | string | Yes | Bounding box as west,south,east,north |
layer | string | No | S-57 object class (e.g. DEPARE, LIGHTS). Comma-separated for multiple. |
limit | integer | No | Max features to return (default 100, max 1000) |
offset | integer | No | Pagination offset |
Response
response.json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[[-70.86, 42.02], ...]]
},
"properties": {
"layer": "DEPARE",
"DRVAL1": 0,
"DRVAL2": 3.5,
"cell_id": "US5MA11M",
"edition": 12
}
}
],
"total_count": 847,
"limit": 100,
"offset": 0
}Pagination
Use offset and limit to page through large result sets. The total_count field indicates the total number of matching features.
pagination.ts
// Fetch all features in pages of 100
let offset = 0;
let allFeatures = [];
while (true) {
const res = await fetch(
`https://api.chrt.co/v1/features?bbox=-71,42,-70,43&limit=100&offset=${offset}`,
{ headers: { 'x-api-key': API_KEY } }
);
const data = await res.json();
allFeatures.push(...data.features);
if (offset + data.features.length >= data.total_count) break;
offset += 100;
}Filtering by layer
Pass multiple layers as comma-separated values:
curl
curl "https://api.chrt.co/v1/features?bbox=-71,42,-70,43&layer=DEPARE,DEPCNT&limit=50" \
-H "x-api-key: YOUR_API_KEY"Error responses
400-bad-request.json
{
"error": "bad_request",
"message": "Invalid bbox parameter. Expected format: west,south,east,north"
}401-unauthorized.json
{
"error": "unauthorized",
"message": "Invalid or missing API key."
}See the full Error Codes reference for all possible error responses.
Query depth areas
curl
curl "https://api.chrt.co/v1/features?bbox=-71,42,-70,43&layer=DEPARE&limit=5" \
-H "x-api-key: YOUR_API_KEY"response
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": { "type": "Polygon", "coordinates": [[...]] },
"properties": {
"layer": "DEPARE",
"DRVAL1": 0,
"DRVAL2": 3.5,
"cell_id": "US5MA11M",
"edition": 12
}
}
],
"total_count": 847,
"limit": 5,
"offset": 0
}For situational awareness only — not for primary navigation. CHRT is not an ECDIS and is not SOLAS-compliant.