---
type: snippet
tags: ['nodejs', 'turf', 'geojson']
status: release
ctime: 2025-01-01
mtime: 2025-01-01
---

turf.js로 좌표가 영역 내에 있는지 확인

```javascript
const turf = require('@turf/turf')

const polygon = turf.polygon([
  [
    [-73.981, 40.768],
    [-73.981, 40.764],
    [-73.975, 40.764],
    [-73.975, 40.768],
    [-73.981, 40.768], // 닫기
  ],
])

const point = turf.point([-73.978, 40.766])

turf.booleanPointInPolygon(point, polygon) // true/false
```

`npm install @turf/turf`
