pointOnFeature
描述
¥Description
获取要素或要素集合,并返回保证位于要素表面的 点 点。
¥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
-
给定 LineString,该点将位于字符串上。
¥Given a LineString, the point will be along the string
-
给定 点,该点将与输入相同。
¥Given a Point, the point will the same as the input
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | 任意要素或要素集合 |
返回
¥Returns
¥Feature<Point> a point on the surface of 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(...);