@chrtco/sdk 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +25 -1
- package/dist/atlas/browser.cjs.map +1 -1
- package/dist/atlas/browser.js.map +1 -1
- package/dist/index.cjs +702 -418
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +247 -172
- package/dist/index.d.ts +247 -172
- package/dist/index.js +699 -418
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to `@chrtco/sdk` will be documented in this file.
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
|
+
- **Render-mode lever on the Style API** (`sail#2`): `StyleUrlOptions.mode` /
|
|
9
|
+
`OfflineFetchStyleOptions.mode` — `"continuous"` (default) or
|
|
10
|
+
`"chart:{band}"` (`chart:Overview | chart:General | chart:Coastal |
|
|
11
|
+
chart:Approach | chart:Harbor`) — threads `?mode=` to the served style
|
|
12
|
+
routes (online `style.json` and offline `/v1/offline/styles/{region}`),
|
|
13
|
+
which lock the portrayal to one scale band with cascade fallback: the
|
|
14
|
+
served twin of the app's Map Mode toggle, now available to every API
|
|
15
|
+
consumer, online and offshore. New exports: `ChrtStyleMode`,
|
|
16
|
+
`CHRT_STYLE_MODES`, `normalizeStyleMode()`, `styleModeBand()`.
|
|
17
|
+
`OfflineStyleResponse.mode` echoes the resolved mode. Servers reject
|
|
18
|
+
invalid modes AND unknown style-route query params with typed 400s
|
|
19
|
+
(`invalid_mode` / `unknown_param`) instead of silently serving the
|
|
20
|
+
default document.
|
|
21
|
+
- **`OfflineFetchStyleOptions.symbols`** — the offline style route has
|
|
22
|
+
accepted `?symbols=s52|s101|chrt|raster` all along, but
|
|
23
|
+
`chrt.offline.fetchStyle()` had no way to send it, so native clients could
|
|
24
|
+
only ever fetch the default `s52` offline style. Now threaded through
|
|
25
|
+
(omitted → worker default `s52`), typed with the same `ChrtSymbolSet` as
|
|
26
|
+
the online `StyleUrlOptions.symbols`. `OfflineStyleResponse.symbols` types
|
|
27
|
+
the echoed set the worker already returns.
|
|
8
28
|
- **Served styles now render in MapLibre Native as shipped.** Every generated
|
|
9
29
|
style begins with a `chrt-background` layer (S-52 NODTA backdrop per
|
|
10
30
|
palette) — previously native renderers drew a black void and
|
package/README.md
CHANGED
|
@@ -243,7 +243,8 @@ curl -X POST https://api.chrt.co/v1/mint/tile-token \
|
|
|
243
243
|
curl https://tiles.chrt.co/v1/styles/NOAA_ENC/style.json?theme=day \
|
|
244
244
|
-H "Authorization: Bearer $TOKEN"
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
# --compressed matters: see "Tiles are gzipped" below.
|
|
247
|
+
curl --compressed https://tiles.chrt.co/v1/tiles/NOAA_ENC/12/1234/1543.mvt \
|
|
247
248
|
-H "Authorization: Bearer $TOKEN"
|
|
248
249
|
```
|
|
249
250
|
|
|
@@ -251,6 +252,29 @@ The returned document is a standard MapLibre style — hand it to MapLibre Nativ
|
|
|
251
252
|
`maplibre-gl`, or any renderer that speaks the style spec. Point your renderer's request transformer
|
|
252
253
|
at the same `Authorization: Bearer` header so tile requests carry it too.
|
|
253
254
|
|
|
255
|
+
### Tiles are gzipped — send `Accept-Encoding: gzip`
|
|
256
|
+
|
|
257
|
+
Tiles are stored gzip-compressed in the PMTiles archive, and the edge negotiates per request:
|
|
258
|
+
ask for `gzip` and you get gzip (`content-encoding: gzip` on the response); ask for `identity`,
|
|
259
|
+
or send no `Accept-Encoding` at all, and you get the uncompressed bytes.
|
|
260
|
+
|
|
261
|
+
**This changes tile-budget arithmetic by 2–2.5×.** MapLibre GL JS, MapLibre Native, every browser,
|
|
262
|
+
and this SDK all send `Accept-Encoding: gzip` automatically — the compressed figure is what your
|
|
263
|
+
users actually transfer. **Plain `curl` sends no `Accept-Encoding` at all**, so `curl -o tile.mvt`
|
|
264
|
+
measures the *uncompressed* size. Use `curl --compressed` (as above), or read `content-encoding`
|
|
265
|
+
off the response, before sizing a cache, a bundle, or a data plan.
|
|
266
|
+
|
|
267
|
+
Reference measurement, prod `NOAA_ENC`, 2026-07-27, tile `z11/620/757` (Boston):
|
|
268
|
+
|
|
269
|
+
| `Accept-Encoding` | Bytes on the wire |
|
|
270
|
+
|---|---|
|
|
271
|
+
| *(absent)* / `identity` | 1,152,506 B (1.10 MB) |
|
|
272
|
+
| `gzip` | 462,273 B (451 KB) |
|
|
273
|
+
|
|
274
|
+
Tile size tracks **feature density** far more than zoom — a harbor tile over a dense port dwarfs an
|
|
275
|
+
offshore tile at the same zoom, and a tile with no data returns `204` with no body at all. Sample a
|
|
276
|
+
spread of tiles across your own area of operations rather than extrapolating from one.
|
|
277
|
+
|
|
254
278
|
The REST endpoints in the table below (`/v1/features`, `/v1/query`, `/v1/query/ahead`, `/v1/cells`,
|
|
255
279
|
`/v1/coverage`) take the API key directly as `x-api-key` — no token minting needed.
|
|
256
280
|
|