geometry
描述
¥Description
Creates a GeoJSON 几何图形 from a Geometry string type & coordinates.For GeometryCollection type use 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 | Record<string,never> | (默认 ) |
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(...);