I have a Multipolygon that has 5 separate polygons and I want to get only the geometry of the biggest polygon.

How can I get the largest polygon from the multipolygon?

1 Answer 1


If you sort the polygons in descending size order it will be the first entry in the array

multipolygon.getPolygons().sort(function(polygon1, polygon2) {return polygon2.getArea() - polygon1.getArea();})[0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.