Trait geozero::ToSvg

source ·
pub trait ToSvg {
    // Required methods
    fn to_svg(&self) -> Result<String>;
    fn to_svg_document(&self) -> Result<String>;
}
Expand description

Convert to SVG.

§Usage example:

Convert a geo-types Polygon to an SVG document:

use geozero::ToSvg;
use geo_types::polygon;

let geom: geo_types::Geometry<f64> = polygon![
    (x: 220., y: 10.),
    (x: 300., y: 210.),
    (x: 170., y: 250.),
    (x: 123., y: 234.),
]
.into();

println!("{}", &geom.to_svg_document().unwrap());

Required Methods§

source

fn to_svg(&self) -> Result<String>

Convert to SVG geometry.

source

fn to_svg_document(&self) -> Result<String>

Convert to SVG document.

Implementors§