描述
从 Feature 或 Geometry 对象获取 Geometry
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| geojson | Feature | Geometry | GeoJSON Feature 或 Geometry 对象 |
返回值
Geometry | null GeoJSON Geometry 对象
示例
javascript
var point = {
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [110, 40],
},
};
var geom = turf.getGeom(point);
//={"type": "Point", "coordinates": [110, 40]}安装
javascript
$ npm install @turf/invariant
import { getGeom } from "@turf/invariant";
const result = getGeom(...);javascript
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.getGeom(...);