pub enum Area {}
Expand description
An area, as the name suggests, is some mapped area with tags.
Way or Relation?
An “area” is actually not a type of object defined by osm. It is more like a meta object. In osm an “area” is ether a single way or a relation of ways with appropriated tags.
Use is_from_way
to check what a given area is actually saved as
and original_id
to get the underlying object’s is.
Multipolygon
A multipolygon consists of multiple polygons named “outer rings” which contain “inner rings”.
These are polygons as well, which are “cut out” from their outer ring.
Use outer_rings
and inner_rings
to access the area’s rings.
Each ring i.e. polygon is just a list of points.
While the general shape of an area is a multipolygon, most areas are just a single outer ring without any inner ones.
For example most residential buildings are just a single polygon.
Use is_multipolygon
and num_rings
to check an area’s shape.
Implementations§
source§impl Area
impl Area
sourcepub fn is_from_way(&self) -> bool
pub fn is_from_way(&self) -> bool
Was this area created from a way? (In contrast to areas created from a relation and their members.)
sourcepub fn original_id(&self) -> i64
pub fn original_id(&self) -> i64
Return the Id of the way or relation this area was created from.
sourcepub fn num_rings(&self) -> (usize, usize)
pub fn num_rings(&self) -> (usize, usize)
Count the number of outer and inner rings of this area.
sourcepub fn is_multipolygon(&self) -> bool
pub fn is_multipolygon(&self) -> bool
Check whether this area is a multipolygon, ie. whether it has more than one outer ring.
sourcepub fn outer_rings(&self) -> impl Iterator<Item = &OuterRing>
pub fn outer_rings(&self) -> impl Iterator<Item = &OuterRing>
Return an iterator over all outer rings.
sourcepub fn inner_rings<'a>(
&'a self,
outer: &'a OuterRing
) -> impl Iterator<Item = &'a InnerRing> + 'a
pub fn inner_rings<'a>(
&'a self,
outer: &'a OuterRing
) -> impl Iterator<Item = &'a InnerRing> + 'a
Return an iterator over all inner rings in the given outer ring.
Methods from Deref<Target = OSMObject>§
sourcepub fn positive_id(&self) -> u64
pub fn positive_id(&self) -> u64
Get absolute value of the ID of this object.
sourcepub fn user_is_anonymous(&self) -> bool
pub fn user_is_anonymous(&self) -> bool
Is this user anonymous?
Get the list of tags for this object.
Trait Implementations§
source§impl AsMut<Item> for Area
impl AsMut<Item> for Area
source§fn as_mut(&mut self) -> &mut Item
fn as_mut(&mut self) -> &mut Item
Cast to an crate::item::Item reference
source§impl AsMut<OSMObject> for Area
impl AsMut<OSMObject> for Area
source§fn as_mut(&mut self) -> &mut OSMObject
fn as_mut(&mut self) -> &mut OSMObject
Cast to an crate::object::OSMObject reference
source§impl AsRef<Item> for Area
impl AsRef<Item> for Area
source§fn as_ref(&self) -> &Item
fn as_ref(&self) -> &Item
Cast to an crate::item::Item reference
source§impl AsRef<OSMObject> for Area
impl AsRef<OSMObject> for Area
source§fn as_ref(&self) -> &OSMObject
fn as_ref(&self) -> &OSMObject
Cast to an crate::object::OSMObject reference