🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@turf/area

Package Overview
Dependencies
Maintainers
0
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/area

turf area module

7.2.0
latest
Source
npm
Version published
Weekly downloads
857K
-18.61%
Maintainers
0
Weekly downloads
 
Created

What is @turf/area?

@turf/area is a module from the Turf.js library that allows you to calculate the area of GeoJSON polygons. It is useful for geospatial analysis and can handle complex polygons, including those with holes.

What are @turf/area's main functionalities?

Calculate area of a simple polygon

This feature allows you to calculate the area of a simple polygon. The code sample demonstrates how to create a polygon and calculate its area using the @turf/area module.

const turf = require('@turf/turf');
const polygon = turf.polygon([[
  [-74.0059413, 40.7127837],
  [-73.935242, 40.730610],
  [-73.944158, 40.678178],
  [-74.0059413, 40.7127837]
]]);
const area = turf.area(polygon);
console.log(area);

Calculate area of a polygon with holes

This feature allows you to calculate the area of a polygon that contains holes. The code sample demonstrates how to create such a polygon and calculate its area using the @turf/area module.

const turf = require('@turf/turf');
const polygonWithHole = turf.polygon([[
  [-74.0059413, 40.7127837],
  [-73.935242, 40.730610],
  [-73.944158, 40.678178],
  [-74.0059413, 40.7127837]
], [
  [-73.965242, 40.7127837],
  [-73.955242, 40.7227837],
  [-73.945242, 40.7127837],
  [-73.965242, 40.7127837]
]]);
const area = turf.area(polygonWithHole);
console.log(area);

Other packages similar to @turf/area

Keywords

turf

FAQs

Package last updated on 29 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts