Atlaslog
Atlaslog / Turf.js / API reference / pointInPolygon
Turf.js · API reference

pointInPolygon

Quick answer

pointInPolygon tests whether a Point lies inside a Polygon or MultiPolygon and returns a boolean, honouring interior rings as holes. Call turf.pointInPolygon(point, polygon, {ignoreBoundary}); by default points exactly on the boundary count as inside. booleanPointInPolygon is the feature-oriented equivalent and underpins several other boolean relation helpers.

Last verified 2026-11-03 · Turf.js 7.x · Cite this page
turf.pointInPolygon( point , polygon , options ) → boolean
Key points
Example
var inPoly = turf.pointInPolygon || turf.booleanPointInPolygon;
console.log(inPoly(turf.point([116.39, 39.90]), polygon));
var park = turf.polygon([[
  [116.300, 39.950], [116.360, 39.950], [116.360, 39.995],
  [116.300, 39.995], [116.300, 39.950]
]]);

var inside = turf.point([116.330, 39.970]);
var outside = turf.point([116.380, 39.970]);
var onEdge  = turf.point([116.300, 39.970]);

console.log(turf.pointInPolygon(inside, park));     // true
console.log(turf.pointInPolygon(outside, park));    // false
console.log(turf.pointInPolygon(onEdge, park));     // true
console.log(turf.pointInPolygon(onEdge, park, { ignoreBoundary: true })); // false
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). pointInPolygon. https://www.jingweizhi.com/en/turf/api/point-in-polygon.html (accessed 2026-11-03).