turf-centroid

WebJar for turf-centroid

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

turf-centroid
Last Version

Last Version

3.0.12
Release Date

Release Date

Type

Type

jar
Description

Description

turf-centroid
WebJar for turf-centroid
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/turf-junkyard/turf-centroid

Download turf-centroid

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/turf-centroid/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>turf-centroid</artifactId>
    <version>3.0.12</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/turf-centroid/
implementation 'org.webjars.npm:turf-centroid:3.0.12'
// https://jarcasting.com/artifacts/org.webjars.npm/turf-centroid/
implementation ("org.webjars.npm:turf-centroid:3.0.12")
'org.webjars.npm:turf-centroid:jar:3.0.12'
<dependency org="org.webjars.npm" name="turf-centroid" rev="3.0.12">
  <artifact name="turf-centroid" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='turf-centroid', version='3.0.12')
)
libraryDependencies += "org.webjars.npm" % "turf-centroid" % "3.0.12"
[org.webjars.npm/turf-centroid "3.0.12"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : turf-meta jar [3.0.12,4)
org.webjars.npm : turf-helpers jar [3.0.12,4)

Project Modules

There are no modules declared in this project.

turf-centroid

build status

turf centroid module

turf.centroid(features)

Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons.

Parameters

parameter type description
features Feature,FeatureCollection input features

Example

var poly = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [105.818939,21.004714],
      [105.818939,21.061754],
      [105.890007,21.061754],
      [105.890007,21.004714],
      [105.818939,21.004714]
    ]]
  }
};

var centroidPt = turf.centroid(poly);

var result = {
  "type": "FeatureCollection",
  "features": [poly, centroidPt]
};

//=result

Returns Feature.<Point>, the centroid of the input features

Installation

Requires nodejs.

$ npm install turf-centroid

Tests

$ npm test
org.webjars.npm

deprecated turf modules: do not use or reference, for redirects only

turf is now a monorepo: all turf modules are in Turfjs/turf

Versions

Version
3.0.12