Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf-area

Package Overview
Dependencies
Maintainers
8
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-area - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

43

index.js
var geometryArea = require('geojson-area').geometry;
/**
* Given any kind of GeoJSON feature, return the area of that feature,
* Takes a {@link GeoJSON} feature or {@link FeatureCollection} of any type and returns the area of that feature
* in square meters.
*
* @module turf/area
* @param {GeoJSON} input
* @category measurement
* @param {GeoJSON} input a {@link Feature} or {@link FeatureCollection} of any type
* @return {Number} area in square meters
* @example
* var polygons = turf.featurecollection([
* turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]),
* turf.polygon([[[10,0],[20,10],[20,20], [20,0]]])]);
* var polygons = {
* "type": "FeatureCollection",
* "features": [
* {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Polygon",
* "coordinates": [[
* [-67.031021, 10.458102],
* [-67.031021, 10.53372],
* [-66.929397, 10.53372],
* [-66.929397, 10.458102],
* [-67.031021, 10.458102]
* ]]
* }
* }, {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Polygon",
* "coordinates": [[
* [-66.919784, 10.397325],
* [-66.919784, 10.513467],
* [-66.805114, 10.513467],
* [-66.805114, 10.397325],
* [-66.919784, 10.397325]
* ]]
* }
* }
* ]
* };
*
* var area = turf.area(polygons);
*
* //=area

@@ -15,0 +48,0 @@ */

9

package.json
{
"name": "turf-area",
"version": "1.1.0",
"version": "1.1.1",
"description": "calculate the area of a polygon or multipolygon feature",
"main": "index.js",
"scripts": {
"test": "tape test.js"
"test": "tape test.js",
"doc": "dox -r < index.js | doxme --readme > README.md"
},

@@ -25,4 +26,6 @@ "keywords": [

"devDependencies": {
"tape": "^3.0.3"
"tape": "^3.5.0",
"dox": "^0.6.1",
"doxme": "^1.4.3"
}
}

@@ -1,35 +0,43 @@

turf-area
==========
# turf-area
[![Build Status](https://travis-ci.org/Turfjs/turf-area.svg)](https://travis-ci.org/Turfjs/turf-area)
[![build status](https://secure.travis-ci.org/Turfjs/turf-area.png)](http://travis-ci.org/Turfjs/turf-area)
Calculates the total geographical area in meters squared of any GeoJSON object.
calculate the area of a polygon or multipolygon feature
### Install
```sh
npm install turf-area
```
### `turf.area(input)`
Given any kind of GeoJSON feature, return the area of that feature,
in square meters.
### Parameters
|name|description|
|---|---|
|input|FeatureCollection, Polygon, or MultiPolygon|
| parameter | type | description |
| --------- | ------- | ----------- |
| `input` | GeoJSON | |
### Usage
### Example
```js
area(input)
var polygons = turf.featurecollection([
turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]),
turf.polygon([[[10,0],[20,10],[20,20], [20,0]]])]);
var area = turf.area(polygons);
//=area
```
### Example
## Installation
```js
var getArea = require('turf-area')
var polygon = require('turf-polygon')
var poly1 = polygon([[[0,0],[10,0],[10,10], [0,10]]])
var area = getArea(poly1)
Requires [nodejs](http://nodejs.org/).
console.log(area)
```sh
$ npm install turf-area
```
## Tests
```sh
$ npm test
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc