Trait geoarrow2::algorithm::geo::bounding_rect::BoundingRect
source · pub trait BoundingRect {
// Required method
fn bounding_rect(&self) -> RectArray;
}
Expand description
Calculation of the bounding rectangle of a geometry.
Required Methods§
sourcefn bounding_rect(&self) -> RectArray
fn bounding_rect(&self) -> RectArray
Return the bounding rectangle of a geometry
Examples
use geo::BoundingRect;
use geo::line_string;
let line_string = line_string![
(x: 40.02f64, y: 116.34),
(x: 42.02f64, y: 116.34),
(x: 42.02f64, y: 118.34),
];
let bounding_rect = line_string.bounding_rect().unwrap();
assert_eq!(40.02f64, bounding_rect.min().x);
assert_eq!(42.02f64, bounding_rect.max().x);
assert_eq!(116.34, bounding_rect.min().y);
assert_eq!(118.34, bounding_rect.max().y);