Struct geojson::FeatureCollection
source · pub struct FeatureCollection {
pub bbox: Option<Bbox>,
pub features: Vec<Feature>,
pub foreign_members: Option<JsonObject>,
}
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::{Feature, FeatureCollection, 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<JsonObject>
Foreign Members
Implementations§
source§impl FeatureCollection
impl FeatureCollection
pub fn from_json_object(object: JsonObject) -> Result<Self>
pub fn from_json_value(value: JsonValue) -> Result<Self>
Trait Implementations§
source§impl Clone for FeatureCollection
impl Clone for FeatureCollection
source§fn clone(&self) -> FeatureCollection
fn clone(&self) -> FeatureCollection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FeatureCollection
impl Debug for FeatureCollection
source§impl<'de> Deserialize<'de> for FeatureCollection
impl<'de> Deserialize<'de> for FeatureCollection
source§fn 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
source§impl Display for FeatureCollection
impl Display for FeatureCollection
source§impl<'a> From<&'a FeatureCollection> for JsonObject
impl<'a> From<&'a FeatureCollection> for JsonObject
source§fn from(fc: &'a FeatureCollection) -> JsonObject
fn from(fc: &'a FeatureCollection) -> JsonObject
Converts to this type from the input type.
source§impl<'a, T> From<&'a GeometryCollection<T>> for FeatureCollectionwhere
T: CoordFloat,
impl<'a, T> From<&'a GeometryCollection<T>> for FeatureCollectionwhere
T: CoordFloat,
source§fn from(geometry_collection: &GeometryCollection<T>) -> Self
fn from(geometry_collection: &GeometryCollection<T>) -> Self
Converts to this type from the input type.
source§impl From<FeatureCollection> for GeoJson
impl From<FeatureCollection> for GeoJson
source§fn from(feature_collection: FeatureCollection) -> GeoJson
fn from(feature_collection: FeatureCollection) -> GeoJson
Converts to this type from the input type.
source§impl FromIterator<Feature> for FeatureCollection
impl FromIterator<Feature> for FeatureCollection
Create a FeatureCollection
using the collect
method on an iterator of Feature
s. 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.
source§impl FromStr for FeatureCollection
impl FromStr for FeatureCollection
source§impl<'a> IntoIterator for &'a FeatureCollection
impl<'a> IntoIterator for &'a FeatureCollection
source§impl IntoIterator for FeatureCollection
impl IntoIterator for FeatureCollection
source§impl PartialEq for FeatureCollection
impl PartialEq for FeatureCollection
source§impl Serialize for FeatureCollection
impl Serialize for FeatureCollection
source§impl<T> TryFrom<FeatureCollection> for Geometry<T>where
T: CoordFloat,
impl<T> TryFrom<FeatureCollection> for Geometry<T>where
T: CoordFloat,
source§impl TryFrom<GeoJson> for FeatureCollection
impl TryFrom<GeoJson> for FeatureCollection
source§impl TryFrom<Value> for FeatureCollection
impl TryFrom<Value> for FeatureCollection
impl StructuralPartialEq for FeatureCollection
Auto Trait Implementations§
impl Freeze for FeatureCollection
impl RefUnwindSafe for FeatureCollection
impl Send for FeatureCollection
impl Sync for FeatureCollection
impl Unpin for FeatureCollection
impl UnwindSafe for FeatureCollection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)