Skip to main content
Version: 7.2.0

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

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

返回

¥Returns

特性<> 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(...);