[−][src]Function geojson::quick_collection
pub fn quick_collection<T>(
gj: &GeoJson
) -> Result<GeometryCollection<T>, GJError> where
T: Float,
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 geojson::{GeoJson, quick_collection}; use geo_types::GeometryCollection; 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();