feature
描述
¥Description
Wraps a GeoJSON 几何图形 in a GeoJSON 特性.
¥Wraps a GeoJSON Geometry in a GeoJSON Feature.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geom | G | null | |
properties? | GeoJsonProperties | an Object of key-value pairs to add as properties (default ) |
options? | 对象 | 可选参数(默认 ) |
options.bbox? | BBox | Bounding Box Array [west, south, east, north] associated with the Feature |
options.id? | ID | Identifier associated with the Feature |
geometry | GeometryObject | 输入几何图形 |
返回
¥Returns
特性<GeometryObject, GeoJsonProperties> a GeoJSON Feature
¥Feature<GeometryObject, GeoJsonProperties> a GeoJSON Feature
示例
¥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(...);