Skip to content

A Rust library for slicing GeoJSON data into vector tile on the fly.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

GeoPanic/geojsonvt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geojsonvt

A Rust library for slicing GeoJSON data into vector tile on the fly.

Features

  • Slices large GeoJSON data into vector tiles
  • High performance Rust implementation

Installation

Add the dependency to your Cargo.toml:

[dependencies]
geojsonvt = "0.1.0"

Usage

use geojson::GeoJson;
use geojsonvt::{GeoJSONVT, Options};
use std::fs;
use std::str::FromStr;

fn main() {
    let options = Options {
        max_zoom: 16,
        index_max_zoom: 16,
        index_max_points: 1000,
        generate_id: false,
        tolerance: 16.0,
        extent: 4096,
        buffer: 64,
        line_metrics: false,
    };
    let contents = fs::read_to_string(file_path).expect("Something went wrong reading the file");
    let geo_json = GeoJson::from_str(&contents).unwrap();
    let geojsonvt = GeoJSONVT::from_geojson(geo_json, &options);
    let tile = geojsonvt.get_tile(0, 0, 0);
}

Run Example

cargo run --example main

benchmark

geojson-vt (JS) geojson-vt (JS --jitless) geojson2vt (Py) geojson-vt-rs (rs) geojsonvt (rs,this repo)
2.563s 15.147s 29.943s 5.286 1.617s

About

A Rust library for slicing GeoJSON data into vector tile on the fly.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages