Skip to main content
Version: 7.1.0

geometry

Description

Creates a GeoJSON Geometry from a Geometry string type & coordinates. For GeometryCollection type use helpers.geometryCollection

Parameters

NameTypeDescription
typestringGeometry Type
coordinatesArray<any>Coordinates
options?ObjectOptional Parameters (default {})

Returns

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