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?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityIf 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]