Skip to main content
Version: 7.3.0

pointOnFeature

描述

🌐 Description

获取一个要素或要素集合,并返回一个保证在要素表面上的

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

  • 给定一个多边形,该点将位于多边形的区域内
  • 给定一个LineString,该点将沿着该线串
  • 给定一个,该点将与输入相同

参数

🌐 Parameters

名称类型描述
geojsonGeoJSON任何要素或要素集合

返回

🌐 Returns

Feature<Point> input表面上的一点

示例

🌐 Examples

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

var pointOnPolygon = turf.pointOnFeature(polygon);

安装

🌐 Installation

$ npm install @turf/point-on-feature

import { pointOnFeature } from "@turf/point-on-feature";
const result = pointOnFeature(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.pointOnFeature(...);