Skip to main content
Version: 7.3.0

getCoords

描述

🌐 Description

从要素、几何图形对象或数组中解包坐标

🌐 Unwrap coordinates from a Feature, Geometry Object or an Array

参数

🌐 Parameters

名称类型描述
coordsArray<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(...);