pointOnFeature
描述
¥Description
Takes a Feature or FeatureCollection and returns a 点 guaranteed to be on the surface of the feature.
¥Takes a Feature or FeatureCollection and returns a Point guaranteed to be on the surface of the feature.
-
Given a 多边形, the point will be in the area of the polygon
¥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 点, the point will the same as the input
¥Given a Point, the point will the same as the input
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | 任意要素或要素集合 |
返回
¥Returns
特性<点> a point on the surface of input
¥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(...);