Nefarious Plastic Mannequins
    Have ideas to improve npm?Join in the discussion! »

    @turf/boolean-point-in-polygon
    TypeScript icon, indicating that this package has built-in type declarations

    6.4.0 • Public • Published

    @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 module individually:

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

    Or install the Turf module that includes it as a function:

    $ npm install @turf/turf

    Install

    npm i @turf/boolean-point-in-polygon

    DownloadsWeekly Downloads

    259,201

    Version

    6.4.0

    License

    MIT

    Unpacked Size

    14 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar