Trait sfcgal::FromGeoJSON

source ·
pub trait FromGeoJSON {
    type Err;

    // Required method
    fn from_geojson<T: FromSlice + CoordType + ToSFCGALGeom>(
        geom: &GeometryValue,
    ) -> Result<SFCGeometry>;
}
Expand description

Conversion from GeoJson to SFCGAL Geometries.

Required Associated Types§

Required Methods§

source

fn from_geojson<T: FromSlice + CoordType + ToSFCGALGeom>( geom: &GeometryValue, ) -> Result<SFCGeometry>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl FromGeoJSON for SFCGeometry

Conversion from GeoJson to SFCGAL geometries.

Allows to choose if the constructed SFCGAL geometries will be 2d or 3d.

use sfcgal::{SFCGeometry, FromGeoJSON};
type Point2d = (f64, f64);

let geom = geojson::Geometry {
    bbox: None,
    value: geojson::Value::LineString(vec![vec![101.0, 0.0], vec![102.0, 1.0]]),
    foreign_members: None,
};
let line_sfcgal = SFCGeometry::from_geojson::<Point2d>(&geom.value).unwrap();