geometry
描述
🌐 Description
从几何字符串类型和坐标创建 GeoJSON 几何。
对于 GeometryCollection 类型,请使用 helpers.geometryCollection
🌐 Creates a GeoJSON Geometry from a Geometry string type & coordinates.
For GeometryCollection type use helpers.geometryCollection
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| type | "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | 几何类型 |
| coordinates | Array<any> | 坐标 |
| _options | 记录<字符串, 永不> | (默认 {}) |
| options? | Object | 可选参数 (默认 {}) |
返回
🌐 Returns
Geometry 一个 GeoJSON 几何对象
示例
🌐 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(...);