Skip to main content
Version: 7.3.0

feature

描述

🌐 Description

将 GeoJSON Geometry 封装在 GeoJSON Feature 中。

🌐 Wraps a GeoJSON Geometry in a GeoJSON Feature.

参数

🌐 Parameters

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

返回

🌐 Returns

Feature<GeometryObject, GeoJsonProperties> 一个 GeoJSON 要素

示例

🌐 Examples

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

var feature = turf.feature(geometry);

//=feature

安装

🌐 Installation

$ npm install @turf/helpers

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

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