geometry
Description
Creates a GeoJSON Geometry from a Geometry string type & coordinates.
For GeometryCollection type use helpers.geometryCollection
Parameters
Name | Type | Description |
---|---|---|
type | "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon" | Geometry Type |
coordinates | Array<any> | Coordinates |
_options | Record<string, never> | (default {}) |
options? | Object | Optional 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(...);