Skip to main content

Module geojson

Module geojson 

Source
Expand description

GeoJSON sources, tiled as MapLibre does with geojson-vt: features are projected to the unit Mercator square and simplified once (Douglas-Peucker importance per vertex), world copies wrap at ±180°, and each tile is the features clipped to the tile plus its buffer, with vertices kept where their importance exceeds the tile zoom’s tolerance, rounded to tile coordinates. Tiles are encoded as MVT (one layer, _geojsonTileLayer, as MapLibre’s GeoJSONWrapper names it) so the vector pipeline renders them like any other source.

MapLibre’s options (geojson_worker_source): extent 8192, buffer and tolerance scaled by 8192 / 512 (defaults 128 and 0.375), maxzoom 18. Clipping straight to a tile gives the same geometry as geojson-vt’s recursive splitting: every parent’s clip lines lie outside the child’s buffered region.

Structs§

GeoJsonIndex
A GeoJSON source prepared for tiling.
GeoJsonOptions
Options of a GeoJSON source, in geojson-vt units.