getType
Description
Get GeoJSON object's type, Geometry type is prioritize.
Parameters
Name | Type | Description |
---|---|---|
geojson | GeoJSON | GeoJSON object |
_name? | string | |
name? | string | name 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(...);