geometry
描述
¥Description
根据 Geometry 字符串类型和坐标创建 GeoJSON 几何图形。对于 GeometryCollection 类型,请使用 helpers.geometryCollection
¥Creates a GeoJSON Geometry from a Geometry string type & coordinates.
For GeometryCollection type use helpers.geometryCollection
参数
¥Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| type | "点" | "LineString" | "多边形" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | 几何体类型 |
| coordinates | 数组<任意> | 坐标 |
| _options | 记录<string,从不> | (默认 ) |
| options? | 对象 | 可选参数(默认值:) |
返回
¥Returns
几何图形 GeoJSON 几何体
¥Geometry a GeoJSON Geometry
示例
¥Examples
var type = "Point";
var coordinates = [110, 50];
var geometry = turf.geometry(type, coordinates);
// => geometry
安装
¥Installation
$ npm install @turf/helpers
import { geometry } from "@turf/helpers";
const result = geometry(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.geometry(...);