getCoords
描述
🌐 Description
从要素、几何图形对象或数组中解包坐标
🌐 Unwrap coordinates from a Feature, Geometry Object or an Array
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| coords | Array<any> | Geometry | Feature | 要素、几何对象或数组 |
返回
🌐 Returns
Array<any> coordinates
示例
🌐 Examples
var poly = turf.polygon([
[
[119.32, -8.7],
[119.55, -8.69],
[119.51, -8.54],
[119.32, -8.7],
],
]);
var coords = turf.getCoords(poly);
//= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]
安装
🌐 Installation
$ npm install @turf/invariant
import { getCoords } from "@turf/invariant";
const result = getCoords(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.getCoords(...);