Skip to main content
Version: Next

getType

描述

¥Description

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

参数

¥Parameters

名称类型描述
geojsonGeoJSONGeoJSON 对象
_name?string
name?stringname of the variable to display in error message (unused) (default "geojson")

返回

¥Returns

string GeoJSON 类型

¥string GeoJSON type

示例

¥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(...);