Skip to main content
Version: 7.2.0

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数组<any>坐标
_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(...);