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

@turf/points-within-polygon

Package Overview
Dependencies
Maintainers
9
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/points-within-polygon

turf points-within-polygon module

  • 7.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
696K
decreased by-15.29%
Maintainers
9
Weekly downloads
 
Created

What is @turf/points-within-polygon?

@turf/points-within-polygon is a module from the Turf.js library that allows you to determine which points from a set of points fall within a given polygon. This is particularly useful for geospatial analysis, such as finding all locations within a specific area.

What are @turf/points-within-polygon's main functionalities?

Filter Points Within a Polygon

This feature allows you to filter a collection of points to find those that fall within a specified polygon. The code sample demonstrates creating a set of points and a polygon, then using the `pointsWithinPolygon` function to find which points are inside the polygon.

const turf = require('@turf/turf');

const points = turf.featureCollection([
  turf.point([0, 0]),
  turf.point([1, 1]),
  turf.point([2, 2]),
  turf.point([3, 3])
]);

const polygon = turf.polygon([[
  [0, 0], [0, 2], [2, 2], [2, 0], [0, 0]
]]);

const pointsWithin = turf.pointsWithinPolygon(points, polygon);
console.log(pointsWithin);

Other packages similar to @turf/points-within-polygon

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