user591272
user591272

Reputation:

Leaflet Js computing area of GeoJSON multipolygon

This is realted to this question:

How to get the area string from a polygon using leaflet.draw

The area calculation works for Polygons, not for multipolygons, any idea on a feature that calculates the area of such GeoJSON Feature?

As a workaround, I can transform the multipolygon into polygons, but it's not an ideal solution.

Many thanks, VG.

Upvotes: 4

Views: 3506

Answers (3)

Andrej Gajdos
Andrej Gajdos

Reputation: 871

You can use @turf/area, which can compute area of polygons and multipolygons.

Upvotes: 0

ProblemsOfSumit
ProblemsOfSumit

Reputation: 21325

Leaflet.PM supports editing and cutting of MultiPolygons. Disclaimer: I'm the maintainer.

Upvotes: 1

IvanSanchez
IvanSanchez

Reputation: 19069

You probably want to use Turf.js for these kind of tasks.

Upvotes: 3

Related Questions