geojson_tile_renderer/
lib.rs

1//! # GeoJSON Tile Renderer
2//!
3//! A high-performance Rust library for converting GeoJSON features to PNG tile images
4//! using Web Mercator projection (EPSG:3857).
5//!
6//! ## Features
7//!
8//! - Render GeoJSON features (Polygon, LineString, Point, and Multi* variants) to PNG tiles
9//! - Web Mercator projection for standard web mapping compatibility
10//! - Configurable tile size and styling
11//! - Async/parallel tile generation support
12//! - Zero-copy optimizations for performance
13//!
14//! ## Example
15//!
16//! ```no_run
17//! use geojson_tile_renderer::{TileRenderer, TileCoordinate, Settings, BackgroundColor};
18//!
19//! # fn example() -> Result<(), Box<dyn std::error::Error>> {
20//! // Create a renderer with custom settings
21//! let renderer = TileRenderer::builder()
22//!     .settings(
23//!         Settings::builder()
24//!             .size(512)
25//!             .background_color(BackgroundColor::white())
26//!             .build()?
27//!     )
28//!     .build()?;
29//!
30//! // Load GeoJSON data
31//! let geojson_str = r#"{"type":"FeatureCollection","features":[]}"#;
32//! let feature_collection: geojson::FeatureCollection = geojson_str.parse()?;
33//!
34//! // Render a tile
35//! let tile = TileCoordinate::new(10, 163, 395)?;
36//! let png_data = renderer.render(&feature_collection, tile)?;
37//!
38//! // Save the PNG data to a file
39//! std::fs::write("tile.png", png_data)?;
40//! # Ok(())
41//! # }
42//! ```
43
44pub mod error;
45pub mod types;
46pub mod projection;
47pub mod svg;
48pub mod render;
49
50// Re-export commonly used types
51pub use error::{RenderError, Result};
52pub use types::{BackgroundColor, Settings, SettingsBuilder, TileCoordinate};
53pub use render::{TileRenderer, TileRendererBuilder};