Skip to main content
Version: 7.2.0

getGeom

描述

¥Description

从要素或几何对象获取几何体

¥Get Geometry from Feature or Geometry Object

参数

¥Parameters

名称类型描述
geojson特性 | 几何图形GeoJSON 要素或几何对象

返回

¥Returns

几何图形 | null GeoJSON 几何体对象

¥Geometry | null GeoJSON Geometry Object

示例

¥Examples

var point = {
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [110, 40],
},
};
var geom = turf.getGeom(point);
//={"type": "Point", "coordinates": [110, 40]}

安装

¥Installation

$ npm install @turf/invariant

import { getGeom } from "@turf/invariant";
const result = getGeom(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.getGeom(...);