Function geojson::quick_collection [−][src]
pub fn quick_collection<T>(
gj: &GeoJson
) -> Result<GeometryCollection<T>, GJError> where
T: CoordFloat,
This is supported on crate feature
geo-types
only.A shortcut for producing geo_types
GeometryCollection objects
from arbitrary valid GeoJSON input.
This function is primarily intended for easy processing of GeoJSON FeatureCollection
objects using the geo
crate, and sacrifices a little performance for convenience.
Example
use geo_types::GeometryCollection; use geojson::{quick_collection, GeoJson}; let geojson_str = r#" { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ -0.13583511114120483, 51.5218870403801 ] } } ] } "#; let geojson = geojson_str.parse::<GeoJson>().unwrap(); // Turn the GeoJSON string into a geo_types GeometryCollection let mut collection: GeometryCollection<f64> = quick_collection(&geojson).unwrap();