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

@turf/point-on-feature

Package Overview
Dependencies
Maintainers
9
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/point-on-feature

turf point-on-feature module

  • 7.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
9
Created

What is @turf/point-on-feature?

@turf/point-on-feature is a module from the Turf.js library that allows you to find a point on a given GeoJSON feature. This can be useful for various geospatial analyses, such as finding the centroid of a polygon or a point on a line.

What are @turf/point-on-feature's main functionalities?

Find a point on a polygon

This feature allows you to find a point on a polygon. The code sample demonstrates how to create a polygon and then find a point on it using the @turf/point-on-feature module.

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

Find a point on a line

This feature allows you to find a point on a line. The code sample demonstrates how to create a line and then find a point on it using the @turf/point-on-feature module.

const turf = require('@turf/turf');
const line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);
const pointOnLine = turf.pointOnFeature(line);
console.log(pointOnLine);

Other packages similar to @turf/point-on-feature

Keywords

FAQs

Package last updated on 09 Aug 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

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