geo-svg

This crate is a lib to generate SVG strings from geo-types.

crate.io docs.rs

Below is an example of a geometry collection rendered to SVG.

example

Features

Missing features

Example

The following will show how to convert a line to a SVG string. The [to_svg] method is provided by the [ToSvg] trait which is implemented for most geo-types.

rust use geo_types::{Coordinate, Line}; use geo_svg::ToSvg; let point = Line::new( Coordinate { x: 114.19, y: 22.26 }, Coordinate { x: 15.93, y: -15.76 }, ); println!("{}", point.to_svg());

Result

xml <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="15.83 -15.86 98.46 38.22"><path d="M 114.19 22.26 L 15.93 -15.76" style="stroke:rgb(0,0,0);stroke-width:0.1"/></svg>