Skip to main content
Version: Next

getType

Description

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

Parameters

NameTypeDescription
geojsonGeoJSONGeoJSON object
name?stringname of the variable to display in error message (unused) (default "geojson")

Returns

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