turf point-on-feature module

Usage no npm install needed!

<script type="module">
  import turfPointOnFeature from 'https://cdn.skypack.dev/@turf/point-on-feature';




Takes a Feature or FeatureCollection and returns a Point guaranteed to be on the surface of the feature.

  • Given a Polygon, the point will be in the area of the polygon
  • Given a LineString, the point will be along the string
  • Given a Point, the point will the same as the input


  • geojson GeoJSON any Feature or FeatureCollection


var polygon = turf.polygon([[
  [116, -36],
  [131, -32],
  [146, -43],
  [155, -25],
  [133, -9],
  [111, -22],
  [116, -36]

var pointOnPolygon = turf.pointOnFeature(polygon);

var addToMap = [polygon, pointOnPolygon];

Returns Feature<Point> a point on the surface of input

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.


Install this module individually:

$ npm install @turf/point-on-feature

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

$ npm install @turf/turf