Skip to content

Conversation

@greenlaw
Copy link
Contributor

@greenlaw greenlaw commented Feb 2, 2026

This upgrades the geobuf dependency used by the v2x branch (which is currently still used instead of the latest v3 in some cases).

While this addresses some vulnerabilities in subdependencies, it unfortunately results in some changes to cardboard's behavior--in particular, due to some geobuf encoding efficiency gains, minzoom/maxzoom calculations are different.

I've punted for now on evaluating the downstream implications of this change, but wanted to push this up as a draft PR so we can evaluate those implications.

greenlaw and others added 6 commits January 30, 2026 16:05
Breaking API changes in geobuf 3.x:
- geobuf.featureToGeobuf(f).toBuffer() → Buffer.from(geobuf.encode(f, new Pbf()))
- geobuf.geobufToFeature(buf) → geobuf.decode(new Pbf(buf))

Added pbf ^3.3.0 as a new dependency (required by geobuf 3.x API).

Updated all source files and tests to use the new API. Some tests still
fail due to behavioral differences in geobuf 3.x output format (empty
properties handling, numeric ID preservation).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add lib/geobuf-helpers.js with centralized encode/decode functions
- normalizeFeature ensures backwards compatibility:
  - Adds empty properties object (geobuf 3.x omits them)
  - Converts numeric IDs to strings (geobuf 3.x preserves numbers)
- Update all decode/encode calls to use shared helpers
- Update test expectations for:
  - More compact encoding sizes (geobuf 3.x is ~50% smaller)
  - Different minzoom/maxzoom values (derived from sizes)
  - Changed pbf error message for corrupt data

Note: getDatasetInfo() minzoom/maxzoom values will differ after upgrade
due to more efficient encoding. This affects zoom recommendations only,
not feature storage or retrieval.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant