🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@turf/boolean-point-in-polygon

Package Overview
Dependencies
Maintainers
9
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-point-in-polygon

turf boolean-point-in-polygon module

latest
Source
npmnpm
Version
7.2.0
Version published
Weekly downloads
1.6M
5.78%
Maintainers
9
Weekly downloads
 
Created
Source

@turf/boolean-point-in-polygon

booleanPointInPolygon

Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.

Parameters

  • point Coord input point

  • polygon Feature<(Polygon | MultiPolygon)> input polygon or multipolygon

  • options Object Optional parameters (optional, default {})

    • options.ignoreBoundary boolean True if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false. (optional, default false)

Examples

var pt = turf.point([-77, 44]);
var poly = turf.polygon([[
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41],
  [-81, 41]
]]);

turf.booleanPointInPolygon(pt, poly);
//= true

Returns boolean true if the Point is inside the Polygon; false if the Point is not inside the Polygon

This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.

Installation

Install this single module individually:

$ npm install @turf/boolean-point-in-polygon

Or install the all-encompassing @turf/turf module that includes all modules as functions:

$ npm install @turf/turf

Keywords

geojson

FAQs

Package last updated on 29 Dec 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