Struct geojson::FeatureCollection
source · [−]pub struct FeatureCollection {
pub bbox: Option<Bbox>,
pub features: Vec<Feature>,
pub foreign_members: Option<Map<String, JsonValue>>,
}Expand description
Feature Collection Objects
GeoJSON Format Specification § 3.3
Examples
Serialization:
use geojson::FeatureCollection;
use geojson::GeoJson;
let feature_collection = FeatureCollection {
bbox: None,
features: vec![],
foreign_members: None,
};
let serialized = GeoJson::from(feature_collection).to_string();
assert_eq!(
serialized,
"{\"features\":[],\"type\":\"FeatureCollection\"}"
);Collect from an iterator:
use geojson::{FeatureCollection, Feature, Value};
let fc: FeatureCollection = (0..10).map(|idx| -> Feature {
let c = idx as f64;
Value::Point(vec![1.0 * c, 2.0 * c, 3.0 * c]).into()
}).collect();
assert_eq!(fc.features.len(), 10);Fields
bbox: Option<Bbox>Bounding Box
features: Vec<Feature>foreign_members: Option<Map<String, JsonValue>>Foreign Members
Implementations
Trait Implementations
sourceimpl Clone for FeatureCollection
impl Clone for FeatureCollection
sourcefn clone(&self) -> FeatureCollection
fn clone(&self) -> FeatureCollection
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for FeatureCollection
impl Debug for FeatureCollection
sourceimpl<'de> Deserialize<'de> for FeatureCollection
impl<'de> Deserialize<'de> for FeatureCollection
sourcefn deserialize<D>(deserializer: D) -> Result<FeatureCollection, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<FeatureCollection, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for FeatureCollection
impl Display for FeatureCollection
sourceimpl<'a, T> From<&'a GeometryCollection<T>> for FeatureCollection where
T: CoordFloat,
This is supported on crate feature geo-types only.
impl<'a, T> From<&'a GeometryCollection<T>> for FeatureCollection where
T: CoordFloat,
geo-types only.sourcefn from(geometry_collection: &GeometryCollection<T>) -> Self
fn from(geometry_collection: &GeometryCollection<T>) -> Self
Converts to this type from the input type.
sourceimpl From<FeatureCollection> for GeoJson
impl From<FeatureCollection> for GeoJson
sourcefn from(feature_collection: FeatureCollection) -> GeoJson
fn from(feature_collection: FeatureCollection) -> GeoJson
Converts to this type from the input type.
sourceimpl FromIterator<Feature> for FeatureCollection
impl FromIterator<Feature> for FeatureCollection
Create a FeatureCollection using the collect
method on an iterator of Features. If every item
contains a bounding-box of the same dimension, then the
output has a bounding-box of the union of them.
Otherwise, the output will not have a bounding-box.
sourcefn from_iter<T: IntoIterator<Item = Feature>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Feature>>(iter: T) -> Self
Creates a value from an iterator. Read more
sourceimpl PartialEq<FeatureCollection> for FeatureCollection
impl PartialEq<FeatureCollection> for FeatureCollection
sourcefn eq(&self, other: &FeatureCollection) -> bool
fn eq(&self, other: &FeatureCollection) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &FeatureCollection) -> bool
fn ne(&self, other: &FeatureCollection) -> bool
This method tests for !=.
sourceimpl Serialize for FeatureCollection
impl Serialize for FeatureCollection
sourceimpl<T> TryFrom<FeatureCollection> for Geometry<T> where
T: CoordFloat,
This is supported on crate feature geo-types only.
impl<T> TryFrom<FeatureCollection> for Geometry<T> where
T: CoordFloat,
geo-types only.sourceimpl TryFrom<GeoJson> for FeatureCollection
impl TryFrom<GeoJson> for FeatureCollection
sourceimpl TryFrom<Value> for FeatureCollection
impl TryFrom<Value> for FeatureCollection
impl StructuralPartialEq for FeatureCollection
Auto Trait Implementations
impl RefUnwindSafe for FeatureCollection
impl Send for FeatureCollection
impl Sync for FeatureCollection
impl Unpin for FeatureCollection
impl UnwindSafe for FeatureCollection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more