Skip to main content
Version: 7.1.0

getCoords

Description

Unwrap coordinates from a Feature, Geometry Object or an Array

Parameters

NameTypeDescription
coordsArray<any> | Geometry | FeatureFeature, Geometry Object or an Array

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