Skip to content

描述 ​

将 GeoJSON Geometry 包装在 GeoJSON Feature 中。

参数 ​

名称类型描述
geomG | null
properties?GeoJsonProperties作为属性添加的键值对对象 (默认 {})
options?Object可选参数 (默认 {})
options.bbox?BBox与 Feature 关联的边界框数组 [西, 南, 东, 北]
options.id?Id与 Feature 关联的标识符
geometryGeometryObject输入几何体

返回值 ​

Feature<GeometryObject, GeoJsonProperties> GeoJSON Feature

示例 ​

javascript
var geometry = {
  type: "Point",
  coordinates: [110, 50],
};

var feature = turf.feature(geometry);

//=feature

安装 ​

javascript
$ npm install @turf/helpers

import { feature } from "@turf/helpers";
const result = feature(...);
javascript
$ npm install @turf/turf

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