getGeom
描述
🌐 Description
从要素或几何对象获取几何体
🌐 Get Geometry from Feature or Geometry Object
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| geojson | Feature | Geometry | GeoJSON 特性或几何对象 |
返回
🌐 Returns
Geometry | null GeoJSON 几何对象
示例
🌐 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(...);