Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: provide a function to calculate the area of a (multi)polygon #131

Open
Peque opened this issue Dec 12, 2021 · 2 comments
Open

Comments

@Peque
Copy link

Peque commented Dec 12, 2021

In example:

const polygonClipping = require('polygon-clipping')

const polygon = [[[0,0],[2,0],[0,2],[0,0]]]
polygonClipping.area(polygon) == 2
const multi = [[[[0,0],[2,0],[0,2],[0,0]]], [[[2,2],[4,2],[2,4],[2,2]]]]
polygonClipping.area(multi) == 4
@rowanwins
Copy link
Contributor

There are many other libraries already available which do this, for example @turf/area does it with geojson data or 2d-polygon-area.

@Dylan190774
Copy link

I'd like to see this too.
The 2d-polygon-area library is very old and doesn't work well with ES6 and Typescript.

I also can't figure out how to calculate the different parts of MultiPolygon, since the rings (holes) should not be counted of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants