turf inside module



Takes a Pointand a Polygonor MultiPolygonand determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.


  • pointFeature<Point>input point
  • polygonFeature<(Polygon| MultiPolygon)>input polygon or multipolygon
  • optionsObjectOptional parameters (optional, default {})
    • options.ignoreBoundarybooleanTrue if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false. (optional, default false)


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

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

Returns booleantrueif the Point is inside the Polygon; falseif 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/turfrepository, where you can create PRs and issues.


Install this module individually:

$ npm install @turf/inside

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

$ npm install @turf/turf







  • turf-point

    turf point module turfpoint build status(https://secure.travisci.org/Turfjs/turfpoint.png)(http:/...

    25 天前
  • Turf.js

    Turf.js是什么 什么是Turf.js,a node.js library for performing geospatial operations with geojson Turf.j...

    2 年前
  • @turf/turf

    a JavaScript library for performing geospatial operations with GeoJSON @turf/turf turf Turf is ...

    11 天前
  • @turf/polygon-smooth

    turf polygon smooth module @turf/polygonsmooth polygonSmooth Smooths a Polygon(https://tools....

    7 小时前
  • @turf/points-within-polygon

    turf pointswithinpolygon module @turf/pointswithinpolygon pointsWithinPolygon Finds Points(ht...

    25 天前
  • @turf/nearest-point-on-line

    turf nearestpointonline module @turf/nearestpointonline nearestPointOnLine Takes a Point1 and...

    25 天前
  • @turf/moran-index

    turf moranindex module @turf/moranindex moranIndex Moran's I measures patterns of attribute v...

    8 小时前
  • @turf/length

    turf length module @turf/length length Takes a GeoJSON1 and measures its length in the specif...

    11 天前
  • @turf/helpers

    turf helpers module @turf/helpers earthRadius Earth Radius used with the Harvesine formula an...

    2 个月前
  • @turf/distance-weight

    turf distanceweight module @turf/distanceweight pNormDistance calcualte the Minkowski pnorm d...

    8 小时前


扫码加入 JavaScript 社区