Skip to content

v5.0.0

Choose a tag to compare

@mourner mourner released this 03 Sep 07:41
· 6 commits to main since this release

A rework of geojson-vt's internal data layout that cuts memory use roughly by 2–4 times on large datasets, with the same tile output.

Memory and performance

  • Retained memory after building an index is 45–75% lower across the board (a 205 MB US counties GeoJSON now holds 103 MB instead of 241 MB).
  • Peak memory during tile generation is 45–79% lower, so datasets that used to crash browser tabs now fit.
  • Total allocation during build is 50–90% lower, meaning far less GC pressure.
  • Build time for point datasets is 50–70% faster. Line and polygon datasets are within roughly 10% of v4 on default settings.

API changes

  • Breaking: the default export is now a class. Replace geojsonvt(data, options) with new GeoJSONVT(data, options). The browser global is renamed from geojsonvt to GeoJSONVT.
  • Breaking: getTile returns {features} only. Internal fields like numPoints, source, x, y, z are no longer exposed on the result.
  • New getTileRaw(z, x, y) returns the tile as stored: flat [x, y, x, y, ...] typed arrays with no per-coordinate objects. Zero-copy, read-only, and much cheaper than getTile for renderers that can consume flat coordinates.
  • TypeScript declarations ship with the package. Remove @types/geojson-vt if you have it installed.

Fixes

  • A point lying exactly on a shared tile edge now appears in exactly one tile instead of both.
  • Polygons straddling tile boundaries no longer produce degenerate single-vertex rings at high zooms.
  • Empty parts in a MultiPolygon are skipped instead of breaking the feature.
  • Geometries with missing coordinates throw the standard invalid-GeoJSON error instead of an opaque TypeError.
  • Tile coordinates may differ from v4 by a single pixel in rare cases due to integer coordinate storage. Output is otherwise identical.