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

@turf/center

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/center

turf center module

  • 6.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
657K
decreased by-4.31%
Maintainers
4
Weekly downloads
 
Created

What is @turf/center?

@turf/center is a module from the Turf.js library that calculates the center of a given GeoJSON feature or set of features. It is useful for geographic data analysis and visualization, allowing developers to easily find the central point of various geometries such as polygons, lines, and multi-point collections.

What are @turf/center's main functionalities?

Calculate Center of a Polygon

This feature calculates the center point of a polygon. The code sample demonstrates how to create a polygon and then find its center using the @turf/center package.

const turf = require('@turf/center');
const polygon = turf.polygon([[
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41],
  [-81, 41]
]]);
const center = turf(polygon);
console.log(center);

Calculate Center of a MultiPoint Collection

This feature calculates the center point of a collection of points (MultiPoint). The code sample shows how to create a MultiPoint collection and find its center using the @turf/center package.

const turf = require('@turf/center');
const multiPoint = turf.multiPoint([
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41]
]);
const center = turf(multiPoint);
console.log(center);

Calculate Center of a LineString

This feature calculates the center point of a LineString. The code sample demonstrates how to create a LineString and find its center using the @turf/center package.

const turf = require('@turf/center');
const lineString = turf.lineString([
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41]
]);
const center = turf(lineString);
console.log(center);

Other packages similar to @turf/center

Keywords

FAQs

Package last updated on 23 Feb 2018

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

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