Skip to main content
Version: 7.3.0

getType

描述

🌐 Description

获取 GeoJSON 对象的类型,几何图形类型优先。

🌐 Get GeoJSON object's type, Geometry type is prioritize.

参数

🌐 Parameters

名称类型描述
geojsonGeoJSONGeoJSON 对象
_name?string
name?string在错误消息中显示的变量名称(未使用) (默认值 "geojson")

返回

🌐 Returns

string GeoJSON 类型

示例

🌐 Examples

var point = {
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [110, 40],
},
};
var geom = turf.getType(point);
//="Point"

安装

🌐 Installation

$ npm install @turf/invariant

import { getType } from "@turf/invariant";
const result = getType(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.getType(...);