MaritimeplatformoperationId aggregate
GET/v1/aggregate
Vessel traffic under a cell rolled up by cell and time bucket: exact position counts, and a bound on distinct vessels.
Send Authorization: Bearer sk_live_…. The key's plan must include theplatform product; which plans do.
Explained in Traffic density.
Example
Traffic off San Diego in six-hour buckets.
curl -G "https://api.oslew.com/v1/aggregate" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=32.70,-117.20' \
--data-urlencode 'in_level=6' \
--data-urlencode 'level=8' \
--data-urlencode 'from=1735603200' \
--data-urlencode 'to=1735689600' \
--data-urlencode 'bucket=21600' \
--data-urlencode 'limit=5'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.aggregate(
"32.70,-117.20",
in_level=6,
level=8,
from_=1735603200,
to=1735689600,
bucket=21600,
limit=5,
)import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.aggregate("32.70,-117.20", {
in_level: 6,
level: 8,
from: 1735603200,
to: 1735689600,
bucket: 21600,
limit: 5,
});HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 291
ratelimit-reset: 1
{
"at": [
32.7,
-117.2
],
"cell": 9286140956661252096,
"in_level": 6,
"level": 8,
"from": 1735603200,
"to": 1735689600,
"bucket": 21600,
"rows": [
{
"cell": 9286017811358941184,
"level": 8,
"from": 1735603200,
"to": 1735624800,
"entries": 9,
"positions": 161,
"moving": 161,
"mean_sog_kn": 9.190062111801241,
"vessels_min": 2,
"vessels_max": 10
},
{
"cell": 9286017811358941184,
"level": 8,
"from": 1735624800,
"to": 1735646400,
"entries": 11,
"positions": 134,
"moving": 134,
"mean_sog_kn": 13.72313432835821,
"vessels_min": 1,
"vessels_max": 11
},
{
"cell": 9286017811358941184,
"level": 8,
"from": 1735646400,
"to": 1735668000,
"entries": 5,
"positions": 70,
"moving": 70,
"mean_sog_kn": 15.29857142857143,
"vessels_min": 1,
"vessels_max": 5
},
{
"cell": 9286017811358941184,
"level": 8,
"from": 1735668000,
"to": 1735689600,
"entries": 1,
"positions": 19,
"moving": 19,
"mean_sog_kn": 10.963157894736844,
"vessels_min": 1,
"vessels_max": 1
},
{
"cell": 9286052995731030016,
"level": 8,
"from": 1735603200,
"to": 1735624800,
"entries": 19,
"positions": 26169,
"moving": 719,
"mean_sog_kn": 0.1749933126982307,
"vessels_min": 233,
"vessels_max": 1476
}
],
"provenance": {
"name": "noaa-ais",
"release": "2024-12-31",
"license": "public domain (US Government work)"
},
"took_us": 205
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
Query
| Name | Type | Description |
|---|---|---|
atqueryrequired | string | lat,lon. |
in_levelquery | integer ≥ 0, ≤ 10 default 4 | Level of the region cell around the point. |
levelquery | integer ≥ 0, ≤ 10 | Level of the output cells; default max(in_level, 6). |
fromquery | integer | |
toquery | integer | |
bucketquery | integer ≥ 3600 default 3600 | Seconds. |
limitquery | integer ≤ 10000 default 1000 |
Responses
200 — By cell, then bucket.
atnumber[]requiredbucketintegerrequiredcellintegerrequiredfromintegerrequiredin_levelintegerrequiredlevelintegerrequiredprovenanceSource | nullrequiredlicensestringrequirednamestringrequiredreleasestringrequired
rowsRollup[]requiredcellintegerrequiredentriesintegerrequiredBase entries summed.fromintegerrequiredlevelintegerrequiredmean_sog_knnumber | nullrequiredmovingintegerrequiredReports with speed over ground of at least 0.5 kn.positionsintegerrequiredtointegerrequiredvessels_maxintegerrequiredAnd at most this: the base entries' sum. A distinct count does not add across cells or hours.vessels_minintegerrequiredDistinct vessels are at least this: the largest base entry.
tointegerrequiredtook_usintegerrequired
With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.
Refusals
Every refusal is a JSON object with an error string, except where noted.
| 400 | Bad request. |
| 401 | No key, or one that is unknown, revoked or suspended. |
| 403 | The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does. |
| 429 | This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After. |
| 503 | The pod cannot reach the control plane and its entitlements are too old to trust. Retry. |
A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.
Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.