Skip to content

How to get the bounding rect of a Vec of shapes? #1179

Answered by mthh
nk9 asked this question in Q&A
Discussion options

You must be logged in to vote

I think you can use a GeometryCollection (which is a collection of Geometries) for this.

let vec_mpl: Vec<MultiPolygon<f32>> = vec![mpl1, mpl2];
let gc = GeometryCollection::new_from(vec_mpl.into_iter().map(Geometry::from).collect());
println!("{:?}", gc.bounding_rect());

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nk9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants