pub struct Feature {
pub bbox: Option<Bbox>,
pub geometry: Option<Geometry>,
pub id: Option<Id>,
pub properties: Option<JsonObject>,
pub foreign_members: Option<JsonObject>,
}
Expand description
Feature Objects
Fields§
§bbox: Option<Bbox>
Bounding Box
geometry: Option<Geometry>
Geometry
id: Option<Id>
Identifier
properties: Option<JsonObject>
Properties
GeoJSON Format Specification § 3.2
NOTE: This crate will permissively parse a Feature whose json is missing a properties
key.
Because the spec implies that the properties
key must be present, we will always include
the properties
key when serializing.
foreign_members: Option<JsonObject>
Foreign Members
Implementations§
source§impl Feature
impl Feature
pub fn from_json_object(object: JsonObject) -> Result<Self>
pub fn from_json_value(value: JsonValue) -> Result<Self>
sourcepub fn property(&self, key: impl AsRef<str>) -> Option<&JsonValue>
pub fn property(&self, key: impl AsRef<str>) -> Option<&JsonValue>
Return the value of this property, if it’s set
sourcepub fn contains_property(&self, key: impl AsRef<str>) -> bool
pub fn contains_property(&self, key: impl AsRef<str>) -> bool
Return true iff this key is set
sourcepub fn set_property(
&mut self,
key: impl Into<String>,
value: impl Into<JsonValue>
)
pub fn set_property( &mut self, key: impl Into<String>, value: impl Into<JsonValue> )
Set a property to this value, overwriting any possible older value
sourcepub fn remove_property(&mut self, key: impl AsRef<str>) -> Option<JsonValue>
pub fn remove_property(&mut self, key: impl AsRef<str>) -> Option<JsonValue>
Removes a key from the properties
map, returning the value at the key if the key
was previously in the properties
map.
sourcepub fn len_properties(&self) -> usize
pub fn len_properties(&self) -> usize
The number of properties
sourcepub fn properties_iter(
&self
) -> Box<dyn ExactSizeIterator<Item = (&String, &JsonValue)> + '_>
pub fn properties_iter( &self ) -> Box<dyn ExactSizeIterator<Item = (&String, &JsonValue)> + '_>
Returns an iterator over all the properties
Trait Implementations§
source§impl<'de> Deserialize<'de> for Feature
impl<'de> Deserialize<'de> for Feature
source§fn deserialize<D>(deserializer: D) -> Result<Feature, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Feature, D::Error>where D: Deserializer<'de>,
source§impl<'a> From<&'a Feature> for JsonObject
impl<'a> From<&'a Feature> for JsonObject
source§fn from(feature: &'a Feature) -> JsonObject
fn from(feature: &'a Feature) -> JsonObject
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 PartialEq<Feature> for Feature
impl PartialEq<Feature> for Feature
source§impl<T> TryFrom<Feature> for Geometry<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for Geometry<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for GeometryCollection<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for GeometryCollection<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for LineString<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for LineString<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for MultiLineString<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for MultiLineString<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for MultiPoint<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for MultiPoint<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for MultiPolygon<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for MultiPolygon<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for Point<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for Point<T>where T: CoordFloat,
geo-types
only.source§impl<T> TryFrom<Feature> for Polygon<T>where
T: CoordFloat,
Available on crate feature geo-types
only.
impl<T> TryFrom<Feature> for Polygon<T>where T: CoordFloat,
geo-types
only.