Skip to main content
Version: Next

geometry

Description

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

Parameters

NameTypeDescription
type"Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon"Geometry Type
coordinatesArray<any>Coordinates
_optionsRecord<string, never>(default {})
options?ObjectOptional Parameters (default {})

Returns

Geometry a GeoJSON Geometry

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