Expand description
§GeoJSON Tile Renderer
A high-performance Rust library for converting GeoJSON features to PNG tile images using Web Mercator projection (EPSG:3857).
§Features
- Render GeoJSON features (Polygon, LineString, Point, and Multi* variants) to PNG tiles
- Web Mercator projection for standard web mapping compatibility
- Configurable tile size and styling
- Async/parallel tile generation support
- Zero-copy optimizations for performance
§Example
use geojson_tile_renderer::{TileRenderer, TileCoordinate, Settings, BackgroundColor};
// Create a renderer with custom settings
let renderer = TileRenderer::builder()
.settings(
Settings::builder()
.size(512)
.background_color(BackgroundColor::white())
.build()?
)
.build()?;
// Load GeoJSON data
let geojson_str = r#"{"type":"FeatureCollection","features":[]}"#;
let feature_collection: geojson::FeatureCollection = geojson_str.parse()?;
// Render a tile
let tile = TileCoordinate::new(10, 163, 395)?;
let png_data = renderer.render(&feature_collection, tile)?;
// Save the PNG data to a file
std::fs::write("tile.png", png_data)?;Re-exports§
pub use error::RenderError;pub use error::Result;pub use types::BackgroundColor;pub use types::Settings;pub use types::SettingsBuilder;pub use types::TileCoordinate;pub use render::TileRenderer;pub use render::TileRendererBuilder;