Skip to content

描述 ​

从 Feature 或 Geometry 对象获取 Geometry

参数 ​

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