geojson-tile-renderer 0.1.0

Convert GeoJSON features to PNG tile images with Web Mercator projection
Documentation
use crate::projection::BoundingBox;
use geo_types::Polygon;

/// Context object containing all information needed to transform coordinates to SVG pixels
#[derive(Debug, Clone)]
pub struct SvgContext {
	/// Web Mercator bounding box
	pub mercator_bbox: BoundingBox,
	/// Tile size in pixels
	pub size: f64,
	/// Scaling factor for X coordinates (pixels per degree)
	pub x_scaling_factor: f64,
	/// Scaling factor for Y coordinates (pixels per degree)
	pub y_scaling_factor: f64,
	/// Polygon representing the tile boundary in WGS84 coordinates
	pub image_polygon: Polygon<f64>,
}

impl SvgContext {
	/// Create a new SVG context
	pub fn new(
		mercator_bbox: BoundingBox,
		size: f64,
		x_scaling_factor: f64,
		y_scaling_factor: f64,
		image_polygon: Polygon<f64>,
	) -> Self {
		Self {
			mercator_bbox,
			size,
			x_scaling_factor,
			y_scaling_factor,
			image_polygon,
		}
	}
}