geojson-vt-rs

Crates.iogeojson-vt-rs
lib.rsgeojson-vt-rs
version0.1.1
sourcesrc
created_at2024-08-13 13:44:50.324868
updated_at2024-08-13 13:53:47.790471
descriptionLibrary for slicing GeoJSON into vector tiles
homepage
repository
max_upload_size
id1336050
size5,831,736
Max Ammann (maxammann)

documentation

README

geojson-vt-rs — GeoJSON Vector Tiles

Port to Rust of C++ GeoJSON-VT for slicing GeoJSON into vector tiles on the fly.

A highly efficient Rust library for slicing GeoJSON data into vector tiles on the fly, primarily designed to enable rendering and interacting with large geospatial datasets on the browser side (without a server).

Created to power GeoJSON in maplibre-rs, but can be useful in other visualization platforms like Leaflet, OpenLayers and d3, as well as Node.js server applications.

Resulting tiles conform to the JSON equivalent of the vector tile specification. To make data rendering and interaction fast, the tiles are simplified, retaining the minimum level of detail appropriate for each zoom level (simplifying shapes, filtering out tiny polygons and polylines).

Read more on how the library works on the Mapbox blog.

There is also a C++11 port: geojson-vt-cpp

Options

You can fine-tune the results with an options struct, although the defaults are sensible and work well for most use cases.

Options {
    max_zoom: 18,          // max zoom to preserve detail on; can't be higher than 24
    index_max_zoom: 5,    // max zoom in the tile index
    index_max_points: 100000, // max number of points per tile in the tile index
    generate_id: false,     // whether to generate feature ids, overriding existing ids
    tile: TileOptions {
        tolerance: 3.,     // simplification tolerance (higher means simpler)
        extent: 4096,        // tile extent
        buffer: 64,        // tile buffer on each side
        line_metrics: false, // enable line metrics tracking for LineString/MultiLineString features
    }
}

By default, tiles at zoom levels above index_max_zoom are generated on the fly, but you can pre-generate all possible tiles for data by setting index_max_zoom and max_zoom to the same value and setting indexMaxPoints to 0.

The generate_id option ignores existing id values on the feature objects.

The library only operates on zoom levels up to 24.

Commit count: 0

cargo fmt