Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/helpers

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/helpers - npm Package Compare versions

Comparing version 6.0.1 to 6.1.0

index.ts

591

index.d.ts

@@ -1,224 +0,489 @@

import {
Id, Properties, BBox, Position,
Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon,
GeometryObject, GeoJSONObject, GeometryCollection, Geometry,
GeometryTypes, Types, CollectionTypes, Geometries,
Feature, FeatureCollection
} from './lib/geojson'
export {
Id, Properties, BBox, Position,
Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon,
GeometryObject, GeoJSONObject, GeometryCollection, Geometry,
GeometryTypes, Types, CollectionTypes, Geometries,
Feature, FeatureCollection
}
// TurfJS Combined Types
export type Coord = Feature<Point> | Point | Position;
// TurfJS String Types
export type Units = 'meters' | 'millimeters' | 'centimeters' | 'kilometers' | 'miles' | 'nauticalmiles' | 'inches' | 'yards' | 'feet' | 'radians' | 'degrees'
export type Grid = 'point' | 'square' | 'hex' | 'triangle';
export type Corners = 'sw' | 'se' | 'nw' | 'ne' | 'center' | 'centroid';
export type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
export type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
interface FeatureOptions {
id?: Id;
bbox?: BBox;
}
interface GeometryOptions {
bbox?: BBox;
}
import { BBox, CollectionTypes, Feature, FeatureCollection, GeoJSONObject, Geometries, Geometry, GeometryCollection, GeometryObject, GeometryTypes, Id, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Position, Properties, Types } from "./lib/geojson";
export { Id, Properties, BBox, Position, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryObject, GeoJSONObject, GeometryCollection, Geometry, GeometryTypes, Types, CollectionTypes, Geometries, Feature, FeatureCollection };
export declare type Coord = Feature<Point> | Point | Position;
export declare type Units = "meters" | "millimeters" | "centimeters" | "kilometers" | "acres" | "miles" | "nauticalmiles" | "inches" | "yards" | "feet" | "radians" | "degrees";
export declare type Grid = "point" | "square" | "hex" | "triangle";
export declare type Corners = "sw" | "se" | "nw" | "ne" | "center" | "centroid";
export declare type Lines = LineString | MultiLineString | Polygon | MultiPolygon;
export declare type AllGeoJSON = Feature | FeatureCollection | Geometry | GeometryCollection;
/**
* http://turfjs.org/docs/#feature
* @module helpers
*/
export function feature<G extends Geometry | GeometryCollection, P = Properties>(geometry: G, properties?: P, options?: FeatureOptions): Feature<G, P>;
/**
* http://turfjs.org/docs/#featurecollection
* Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
*
* @memberof helpers
* @type {number}
*/
export function featureCollection<G extends Geometry, P = Properties>(features: Feature<G, P>[], options?: FeatureOptions): FeatureCollection<G, P>;
export function featureCollection(features: Feature<any>[], options?: FeatureOptions): FeatureCollection<any>;
export declare let earthRadius: number;
/**
* http://turfjs.org/docs/#geometry
* Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
*
* @memberof helpers
* @type {Object}
*/
export function geometry(type: 'Point', coordinates: Position, options?: GeometryOptions): Point;
export function geometry(type: 'LineString', coordinates: Position[], options?: GeometryOptions): LineString;
export function geometry(type: 'Polygon', coordinates: Position[][], options?: GeometryOptions): Polygon;
export function geometry(type: 'MultiPoint', coordinates: Position[], options?: GeometryOptions): MultiPoint;
export function geometry(type: 'MultiLineString', coordinates: Position[][], options?: GeometryOptions): MultiLineString;
export function geometry(type: 'MultiPolygon', coordinates: Position[][][], options?: GeometryOptions): MultiPolygon;
export function geometry(type: string, coordinates: any[], options?: GeometryOptions): Geometry;
export declare let factors: {
[key: string]: number;
};
/**
* http://turfjs.org/docs/#point
* Units of measurement factors based on 1 meter.
*
* @memberof helpers
* @type {Object}
*/
export function point<P = Properties>(coordinates: Position, properties?: P, options?: FeatureOptions): Feature<Point, P>;
export declare let unitsFactors: {
[key: string]: number;
};
/**
* http://turfjs.org/docs/#points
* Area of measurement factors based on 1 square meter.
*
* @memberof helpers
* @type {Object}
*/
export function points<P = Properties>(coordinates: Position[], properties?: P, options?: FeatureOptions): FeatureCollection<Point, P>;
export declare let areaFactors: any;
/**
* http://turfjs.org/docs/#polygon
* Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
*
* @name feature
* @param {Geometry} geometry input geometry
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature} a GeoJSON Feature
* @example
* var geometry = {
* "type": "Point",
* "coordinates": [110, 50]
* };
*
* var feature = turf.feature(geometry);
*
* //=feature
*/
export function polygon<P = Properties>(coordinates: Position[][], properties?: P, options?: FeatureOptions): Feature<Polygon, P>;
export declare function feature<G = Geometry, P = Properties>(geom: G, properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<G, P>;
/**
* http://turfjs.org/docs/#polygons
* Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.
* For GeometryCollection type use `helpers.geometryCollection`
*
* @name geometry
* @param {string} type Geometry Type
* @param {Array<any>} coordinates Coordinates
* @param {Object} [options={}] Optional Parameters
* @returns {Geometry} a GeoJSON Geometry
* @example
* var type = "Point";
* var coordinates = [110, 50];
* var geometry = turf.geometry(type, coordinates);
* // => geometry
*/
export function polygons<P = Properties>(coordinates: Position[][][], properties?: P, options?: FeatureOptions): FeatureCollection<Polygon, P>;
export declare function geometry(type: "Point" | "LineString" | "Polygon" | "MultiPoint" | "MultiLineString" | "MultiPolygon", coordinates: any[], options?: {}): Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon;
/**
* http://turfjs.org/docs/#linestring
* Creates a {@link Point} {@link Feature} from a Position.
*
* @name point
* @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<Point>} a Point feature
* @example
* var point = turf.point([-75.343, 39.984]);
*
* //=point
*/
export function lineString<P = Properties>(coordinates: Position[], properties?: P, options?: FeatureOptions): Feature<LineString, P>;
export declare function point<P = Properties>(coordinates: Position, properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<Point, P>;
/**
* http://turfjs.org/docs/#linestrings
* Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.
*
* @name points
* @param {Array<Array<number>>} coordinates an array of Points
* @param {Object} [properties={}] Translate these properties to each Feature
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
* associated with the FeatureCollection
* @param {string|number} [options.id] Identifier associated with the FeatureCollection
* @returns {FeatureCollection<Point>} Point Feature
* @example
* var points = turf.points([
* [-75, 39],
* [-80, 45],
* [-78, 50]
* ]);
*
* //=points
*/
export function lineStrings<P = Properties>(coordinates: Position[][], properties?: P, options?: FeatureOptions): FeatureCollection<LineString, P>;
export declare function points<P = Properties>(coordinates: Position[], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): FeatureCollection<Point, P>;
/**
* http://turfjs.org/docs/#multilinestring
* Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.
*
* @name polygon
* @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<Polygon>} Polygon Feature
* @example
* var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });
*
* //=polygon
*/
export function multiLineString<P = Properties>(coordinates: Position[][], properties?: P, options?: FeatureOptions): Feature<MultiLineString, P>;
export declare function polygon<P = Properties>(coordinates: Position[][], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<Polygon, P>;
/**
* http://turfjs.org/docs/#multipoint
* Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.
*
* @name polygons
* @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygon coordinates
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the FeatureCollection
* @returns {FeatureCollection<Polygon>} Polygon FeatureCollection
* @example
* var polygons = turf.polygons([
* [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],
* [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],
* ]);
*
* //=polygons
*/
export function multiPoint<P = Properties>(coordinates: Position[], properties?: P, options?: FeatureOptions): Feature<MultiPoint, P>;
export declare function polygons<P = Properties>(coordinates: Position[][][], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): FeatureCollection<Polygon, P>;
/**
* http://turfjs.org/docs/#multipolygon
* Creates a {@link LineString} {@link Feature} from an Array of Positions.
*
* @name lineString
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<LineString>} LineString Feature
* @example
* var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});
* var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});
*
* //=linestring1
* //=linestring2
*/
export function multiPolygon<P = Properties>(coordinates: Position[][][], properties?: P, options?: FeatureOptions): Feature<MultiPolygon, P>;
export declare function lineString<P = Properties>(coordinates: Position[], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<LineString, P>;
/**
* http://turfjs.org/docs/#geometrycollection
* Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.
*
* @name lineStrings
* @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
* associated with the FeatureCollection
* @param {string|number} [options.id] Identifier associated with the FeatureCollection
* @returns {FeatureCollection<LineString>} LineString FeatureCollection
* @example
* var linestrings = turf.lineStrings([
* [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],
* [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]
* ]);
*
* //=linestrings
*/
export function geometryCollection<P = Properties>(geometries: Geometries[], properties?: P, options?: FeatureOptions): Feature<GeometryCollection, P>;
export declare function lineStrings<P = Properties>(coordinates: Position[][], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): FeatureCollection<LineString, P>;
/**
* http://turfjs.org/docs/#radianstolength
* Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
*
* @name featureCollection
* @param {Feature[]} features input features
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {FeatureCollection} FeatureCollection of Features
* @example
* var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});
* var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});
* var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});
*
* var collection = turf.featureCollection([
* locationA,
* locationB,
* locationC
* ]);
*
* //=collection
*/
export function radiansToLength(radians: number, units?: Units): number;
export declare function featureCollection<G = Geometry, P = Properties>(features: Array<Feature<G, P>>, options?: {
bbox?: BBox;
id?: Id;
}): FeatureCollection<G, P>;
/**
* http://turfjs.org/docs/#lengthtoradians
* Creates a {@link Feature<MultiLineString>} based on a
* coordinate array. Properties can be added optionally.
*
* @name multiLineString
* @param {Array<Array<Array<number>>>} coordinates an array of LineStrings
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<MultiLineString>} a MultiLineString feature
* @throws {Error} if no coordinates are passed
* @example
* var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
*
* //=multiLine
*/
export function lengthToRadians(distance: number, units?: Units): number;
export declare function multiLineString<P = Properties>(coordinates: Position[][], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<MultiLineString, P>;
/**
* http://turfjs.org/docs/#lengthtodegrees
* Creates a {@link Feature<MultiPoint>} based on a
* coordinate array. Properties can be added optionally.
*
* @name multiPoint
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<MultiPoint>} a MultiPoint feature
* @throws {Error} if no coordinates are passed
* @example
* var multiPt = turf.multiPoint([[0,0],[10,10]]);
*
* //=multiPt
*/
export function lengthToDegrees(distance: number, units?: Units): number;
export declare function multiPoint<P = Properties>(coordinates: Position[], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<MultiPoint, P>;
/**
* http://turfjs.org/docs/#bearingtoazimuth
* Creates a {@link Feature<MultiPolygon>} based on a
* coordinate array. Properties can be added optionally.
*
* @name multiPolygon
* @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<MultiPolygon>} a multipolygon feature
* @throws {Error} if no coordinates are passed
* @example
* var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);
*
* //=multiPoly
*
*/
export function bearingToAzimuth(bearing: number): number;
export declare function multiPolygon<P = Properties>(coordinates: Position[][][], properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<MultiPolygon, P>;
/**
* http://turfjs.org/docs/#radianstodegrees
* Creates a {@link Feature<GeometryCollection>} based on a
* coordinate array. Properties can be added optionally.
*
* @name geometryCollection
* @param {Array<Geometry>} geometries an array of GeoJSON Geometries
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature
* @param {string|number} [options.id] Identifier associated with the Feature
* @returns {Feature<GeometryCollection>} a GeoJSON GeometryCollection Feature
* @example
* var pt = turf.geometry("Point", [100, 0]);
* var line = turf.geometry("LineString", [[101, 0], [102, 1]]);
* var collection = turf.geometryCollection([pt, line]);
*
* // => collection
*/
export function radiansToDegrees(radians: number): number;
export declare function geometryCollection<P = Properties>(geometries: Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon>, properties?: P, options?: {
bbox?: BBox;
id?: Id;
}): Feature<GeometryCollection, P>;
/**
* http://turfjs.org/docs/#degreestoradians
* Round number to precision
*
* @param {number} num Number
* @param {number} [precision=0] Precision
* @returns {number} rounded number
* @example
* turf.round(120.4321)
* //=120
*
* turf.round(120.4321, 2)
* //=120.43
*/
export function degreesToRadians(degrees: number): number;
export declare function round(num: number, precision?: number): number;
/**
* http://turfjs.org/docs/#round
* Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.
* Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
*
* @name radiansToLength
* @param {number} radians in radians across the sphere
* @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres,
* meters, kilometres, kilometers.
* @returns {number} distance
*/
export function round(num: number, precision?: number): number;
export declare function radiansToLength(radians: number, units?: Units): number;
/**
* http://turfjs.org/docs/#convertlength
* Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians
* Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
*
* @name lengthToRadians
* @param {number} distance in real units
* @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres,
* meters, kilometres, kilometers.
* @returns {number} radians
*/
export function convertLength(length: number, originalUnit: Units, finalUnit?: Units): number;
export declare function lengthToRadians(distance: number, units?: Units): number;
/**
* http://turfjs.org/docs/#convertarea
* Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees
* Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet
*
* @name lengthToDegrees
* @param {number} distance in real units
* @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres,
* meters, kilometres, kilometers.
* @returns {number} degrees
*/
export function convertArea(area: number, originalUnit?: Units, finalUnit?: Units): number;
export declare function lengthToDegrees(distance: number, units?: Units): number;
/**
* http://turfjs.org/docs/#isnumber
* Converts any bearing angle from the north line direction (positive clockwise)
* and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line
*
* @name bearingToAzimuth
* @param {number} bearing angle, between -180 and +180 degrees
* @returns {number} angle between 0 and 360 degrees
*/
export function isNumber(num: any): boolean;
export declare function bearingToAzimuth(bearing: number): number;
/**
* http://turfjs.org/docs/#isobject
* Converts an angle in radians to degrees
*
* @name radiansToDegrees
* @param {number} radians angle in radians
* @returns {number} degrees between 0 and 360 degrees
*/
export function isObject(input: any): boolean;
export declare function radiansToDegrees(radians: number): number;
/**
* Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
* Converts an angle in degrees to radians
*
* @name degreesToRadians
* @param {number} degrees angle between 0 and 360 degrees
* @returns {number} angle in radians
*/
export const earthRadius: number;
export declare function degreesToRadians(degrees: number): number;
/**
* Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
* Converts a length to the requested unit.
* Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
*
* @param {number} length to be converted
* @param {Units} [originalUnit="kilometers"] of the length
* @param {Units} [finalUnit="kilometers"] returned unit
* @returns {number} the converted length
*/
export const factors: {
meters: number;
millimeters: number;
centimeters: number;
kilometers: number;
miles: number;
nauticalmiles: number;
inches: number;
yards: number;
feet: number;
}
export declare function convertLength(length: number, originalUnit?: Units, finalUnit?: Units): number;
/**
* Units of measurement factors based on 1 meter.
* Converts a area to the requested unit.
* Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches
* @param {number} area to be converted
* @param {Units} [originalUnit="meters"] of the distance
* @param {Units} [finalUnit="kilometers"] returned unit
* @returns {number} the converted distance
*/
export const unitsFactors: {
meters: number;
millimeters: number;
centimeters: number;
kilometers: number;
miles: number;
nauticalmiles: number;
inches: number;
yards: number;
feet: number;
radians: number;
degrees: number;
};
export declare function convertArea(area: number, originalUnit?: Units, finalUnit?: Units): number;
/**
* Area of measurement factors based on 1 square meter.
* isNumber
*
* @param {*} num Number to validate
* @returns {boolean} true/false
* @example
* turf.isNumber(123)
* //=true
* turf.isNumber('foo')
* //=false
*/
export const areaFactors: {
meters: number;
millimeters: number;
centimeters: number;
kilometers: number;
acres: number;
miles: number;
yards: number;
feet: number;
inches: number;
};
export declare function isNumber(num: any): boolean;
/**
* Validate Id
* isObject
*
* @param {*} input variable to validate
* @returns {boolean} true/false
* @example
* turf.isObject({elevation: 10})
* //=true
* turf.isObject('foo')
* //=false
*/
export function validateId(id: Id): void;
export declare function isObject(input: any): boolean;
/**
* Validate BBox
*
* @private
* @param {Array<number>} bbox BBox to validate
* @returns {void}
* @throws Error if BBox is not valid
* @example
* validateBBox([-180, -40, 110, 50])
* //=OK
* validateBBox([-180, -40])
* //=Error
* validateBBox('Foo')
* //=Error
* validateBBox(5)
* //=Error
* validateBBox(null)
* //=Error
* validateBBox(undefined)
* //=Error
*/
export function validateBBox(bbox: BBox): void;
export declare function validateBBox(bbox: any): void;
/**
* Validate Id
*
* @private
* @param {string|number} id Id to validate
* @returns {void}
* @throws Error if Id is not valid
* @example
* validateId([-180, -40, 110, 50])
* //=Error
* validateId([-180, -40])
* //=Error
* validateId('Foo')
* //=OK
* validateId(5)
* //=OK
* validateId(null)
* //=Error
* validateId(undefined)
* //=Error
*/
export declare function validateId(id: any): void;
export declare function radians2degrees(): void;
export declare function degrees2radians(): void;
export declare function distanceToDegrees(): void;
export declare function distanceToRadians(): void;
export declare function radiansToDistance(): void;
export declare function bearingToAngle(): void;
export declare function convertDistance(): void;

@@ -1,71 +0,80 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module helpers
*/
/**
* Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
*
* @memberof helpers
* @type {number}
*/
var earthRadius = 6371008.8;
exports.earthRadius = 6371008.8;
/**
* Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
*
* @memberof helpers
* @type {Object}
*/
var factors = {
meters: earthRadius,
metres: earthRadius,
millimeters: earthRadius * 1000,
millimetres: earthRadius * 1000,
centimeters: earthRadius * 100,
centimetres: earthRadius * 100,
kilometers: earthRadius / 1000,
kilometres: earthRadius / 1000,
miles: earthRadius / 1609.344,
nauticalmiles: earthRadius / 1852,
inches: earthRadius * 39.370,
yards: earthRadius / 1.0936,
feet: earthRadius * 3.28084,
exports.factors = {
centimeters: exports.earthRadius * 100,
centimetres: exports.earthRadius * 100,
degrees: exports.earthRadius / 111325,
feet: exports.earthRadius * 3.28084,
inches: exports.earthRadius * 39.370,
kilometers: exports.earthRadius / 1000,
kilometres: exports.earthRadius / 1000,
meters: exports.earthRadius,
metres: exports.earthRadius,
miles: exports.earthRadius / 1609.344,
millimeters: exports.earthRadius * 1000,
millimetres: exports.earthRadius * 1000,
nauticalmiles: exports.earthRadius / 1852,
radians: 1,
degrees: earthRadius / 111325,
yards: exports.earthRadius / 1.0936,
};
/**
* Units of measurement factors based on 1 meter.
*
* @memberof helpers
* @type {Object}
*/
var unitsFactors = {
meters: 1,
metres: 1,
millimeters: 1000,
millimetres: 1000,
exports.unitsFactors = {
centimeters: 100,
centimetres: 100,
degrees: 1 / 111325,
feet: 3.28084,
inches: 39.370,
kilometers: 1 / 1000,
kilometres: 1 / 1000,
meters: 1,
metres: 1,
miles: 1 / 1609.344,
millimeters: 1000,
millimetres: 1000,
nauticalmiles: 1 / 1852,
inches: 39.370,
radians: 1 / exports.earthRadius,
yards: 1 / 1.0936,
feet: 3.28084,
radians: 1 / earthRadius,
degrees: 1 / 111325,
};
/**
* Area of measurement factors based on 1 square meter.
*
* @memberof helpers
* @type {Object}
*/
var areaFactors = {
meters: 1,
metres: 1,
millimeters: 1000000,
millimetres: 1000000,
exports.areaFactors = {
acres: 0.000247105,
centimeters: 10000,
centimetres: 10000,
feet: 10.763910417,
inches: 1550.003100006,
kilometers: 0.000001,
kilometres: 0.000001,
acres: 0.000247105,
meters: 1,
metres: 1,
miles: 3.86e-7,
millimeters: 1000000,
millimetres: 1000000,
yards: 1.195990046,
feet: 10.763910417,
inches: 1550.003100006
};
/**

@@ -91,24 +100,16 @@ * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.

*/
function feature(geometry, properties, options) {
// Optional Parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var bbox = options.bbox;
var id = options.id;
// Validation
if (geometry === undefined) throw new Error('geometry is required');
if (properties && properties.constructor !== Object) throw new Error('properties must be an Object');
if (bbox) validateBBox(bbox);
if (id !== 0 && id) validateId(id);
// Main
var feat = {type: 'Feature'};
if (id === 0 || id) feat.id = id;
if (bbox) feat.bbox = bbox;
function feature(geom, properties, options) {
if (options === void 0) { options = {}; }
var feat = { type: "Feature" };
if (options.id === 0 || options.id) {
feat.id = options.id;
}
if (options.bbox) {
feat.bbox = options.bbox;
}
feat.properties = properties || {};
feat.geometry = geometry;
feat.geometry = geom;
return feat;
}
exports.feature = feature;
/**

@@ -120,41 +121,24 @@ * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.

* @param {string} type Geometry Type
* @param {Array<number>} coordinates Coordinates
* @param {Array<any>} coordinates Coordinates
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Geometry
* @returns {Geometry} a GeoJSON Geometry
* @example
* var type = 'Point';
* var type = "Point";
* var coordinates = [110, 50];
*
* var geometry = turf.geometry(type, coordinates);
*
* //=geometry
* // => geometry
*/
function geometry(type, coordinates, options) {
// Optional Parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var bbox = options.bbox;
// Validation
if (!type) throw new Error('type is required');
if (!coordinates) throw new Error('coordinates is required');
if (!Array.isArray(coordinates)) throw new Error('coordinates must be an Array');
if (bbox) validateBBox(bbox);
// Main
var geom;
if (options === void 0) { options = {}; }
switch (type) {
case 'Point': geom = point(coordinates).geometry; break;
case 'LineString': geom = lineString(coordinates).geometry; break;
case 'Polygon': geom = polygon(coordinates).geometry; break;
case 'MultiPoint': geom = multiPoint(coordinates).geometry; break;
case 'MultiLineString': geom = multiLineString(coordinates).geometry; break;
case 'MultiPolygon': geom = multiPolygon(coordinates).geometry; break;
default: throw new Error(type + ' is invalid');
case "Point": return point(coordinates).geometry;
case "LineString": return lineString(coordinates).geometry;
case "Polygon": return polygon(coordinates).geometry;
case "MultiPoint": return multiPoint(coordinates).geometry;
case "MultiLineString": return multiLineString(coordinates).geometry;
case "MultiPolygon": return multiPolygon(coordinates).geometry;
default: throw new Error(type + " is invalid");
}
if (bbox) geom.bbox = bbox;
return geom;
}
exports.geometry = geometry;
/**

@@ -176,13 +160,10 @@ * Creates a {@link Point} {@link Feature} from a Position.

function point(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
if (!Array.isArray(coordinates)) throw new Error('coordinates must be an Array');
if (coordinates.length < 2) throw new Error('coordinates must be at least 2 numbers long');
if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) throw new Error('coordinates must contain numbers');
return feature({
type: 'Point',
coordinates: coordinates
}, properties, options);
if (options === void 0) { options = {}; }
var geom = {
type: "Point",
coordinates: coordinates,
};
return feature(geom, properties, options);
}
exports.point = point;
/**

@@ -195,3 +176,4 @@ * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.

* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the FeatureCollection
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
* associated with the FeatureCollection
* @param {string|number} [options.id] Identifier associated with the FeatureCollection

@@ -209,5 +191,3 @@ * @returns {FeatureCollection<Point>} Point Feature

function points(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
if (!Array.isArray(coordinates)) throw new Error('coordinates must be an Array');
if (options === void 0) { options = {}; }
return featureCollection(coordinates.map(function (coords) {

@@ -217,3 +197,3 @@ return point(coords, properties);

}
exports.points = points;
/**

@@ -235,24 +215,22 @@ * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.

function polygon(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
for (var i = 0; i < coordinates.length; i++) {
var ring = coordinates[i];
if (options === void 0) { options = {}; }
for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
var ring = coordinates_1[_i];
if (ring.length < 4) {
throw new Error('Each LinearRing of a Polygon must have 4 or more Positions.');
throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
}
for (var j = 0; j < ring[ring.length - 1].length; j++) {
// Check if first point of Polygon contains two numbers
if (i === 0 && j === 0 && !isNumber(ring[0][0]) || !isNumber(ring[0][1])) throw new Error('coordinates must contain numbers');
if (ring[ring.length - 1][j] !== ring[0][j]) {
throw new Error('First and last Position are not equivalent.');
throw new Error("First and last Position are not equivalent.");
}
}
}
return feature({
type: 'Polygon',
coordinates: coordinates
}, properties, options);
var geom = {
type: "Polygon",
coordinates: coordinates,
};
return feature(geom, properties, options);
}
exports.polygon = polygon;
/**

@@ -277,5 +255,3 @@ * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.

function polygons(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
if (!Array.isArray(coordinates)) throw new Error('coordinates must be an Array');
if (options === void 0) { options = {}; }
return featureCollection(coordinates.map(function (coords) {

@@ -285,3 +261,3 @@ return polygon(coords, properties);

}
exports.polygons = polygons;
/**

@@ -305,13 +281,13 @@ * Creates a {@link LineString} {@link Feature} from an Array of Positions.

function lineString(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
if (coordinates.length < 2) throw new Error('coordinates must be an array of two or more positions');
// Check if first point of LineString contains two numbers
if (!isNumber(coordinates[0][1]) || !isNumber(coordinates[0][1])) throw new Error('coordinates must contain numbers');
return feature({
type: 'LineString',
coordinates: coordinates
}, properties, options);
if (options === void 0) { options = {}; }
if (coordinates.length < 2) {
throw new Error("coordinates must be an array of two or more positions");
}
var geom = {
type: "LineString",
coordinates: coordinates,
};
return feature(geom, properties, options);
}
exports.lineString = lineString;
/**

@@ -321,6 +297,7 @@ * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.

* @name lineStrings
* @param {Array<Array<number>>} coordinates an array of LinearRings
* @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
* @param {Object} [properties={}] an Object of key-value pairs to add as properties
* @param {Object} [options={}] Optional Parameters
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the FeatureCollection
* @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]
* associated with the FeatureCollection
* @param {string|number} [options.id] Identifier associated with the FeatureCollection

@@ -337,5 +314,3 @@ * @returns {FeatureCollection<LineString>} LineString FeatureCollection

function lineStrings(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
if (!Array.isArray(coordinates)) throw new Error('coordinates must be an Array');
if (options === void 0) { options = {}; }
return featureCollection(coordinates.map(function (coords) {

@@ -345,3 +320,3 @@ return lineString(coords, properties);

}
exports.lineStrings = lineStrings;
/**

@@ -370,22 +345,14 @@ * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.

function featureCollection(features, options) {
// Optional Parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var bbox = options.bbox;
var id = options.id;
// Validation
if (!features) throw new Error('No features passed');
if (!Array.isArray(features)) throw new Error('features must be an Array');
if (bbox) validateBBox(bbox);
if (id) validateId(id);
// Main
var fc = {type: 'FeatureCollection'};
if (id) fc.id = id;
if (bbox) fc.bbox = bbox;
if (options === void 0) { options = {}; }
var fc = { type: "FeatureCollection" };
if (options.id) {
fc.id = options.id;
}
if (options.bbox) {
fc.bbox = options.bbox;
}
fc.features = features;
return fc;
}
exports.featureCollection = featureCollection;
/**

@@ -409,10 +376,10 @@ * Creates a {@link Feature<MultiLineString>} based on a

function multiLineString(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
return feature({
type: 'MultiLineString',
coordinates: coordinates
}, properties, options);
if (options === void 0) { options = {}; }
var geom = {
type: "MultiLineString",
coordinates: coordinates,
};
return feature(geom, properties, options);
}
exports.multiLineString = multiLineString;
/**

@@ -436,10 +403,10 @@ * Creates a {@link Feature<MultiPoint>} based on a

function multiPoint(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
return feature({
type: 'MultiPoint',
coordinates: coordinates
}, properties, options);
if (options === void 0) { options = {}; }
var geom = {
type: "MultiPoint",
coordinates: coordinates,
};
return feature(geom, properties, options);
}
exports.multiPoint = multiPoint;
/**

@@ -464,10 +431,10 @@ * Creates a {@link Feature<MultiPolygon>} based on a

function multiPolygon(coordinates, properties, options) {
if (!coordinates) throw new Error('coordinates is required');
return feature({
type: 'MultiPolygon',
coordinates: coordinates
}, properties, options);
if (options === void 0) { options = {}; }
var geom = {
type: "MultiPolygon",
coordinates: coordinates,
};
return feature(geom, properties, options);
}
exports.multiPolygon = multiPolygon;
/**

@@ -485,24 +452,17 @@ * Creates a {@link Feature<GeometryCollection>} based on a

* @example
* var pt = {
* "type": "Point",
* "coordinates": [100, 0]
* };
* var line = {
* "type": "LineString",
* "coordinates": [ [101, 0], [102, 1] ]
* };
* var pt = turf.geometry("Point", [100, 0]);
* var line = turf.geometry("LineString", [[101, 0], [102, 1]]);
* var collection = turf.geometryCollection([pt, line]);
*
* //=collection
* // => collection
*/
function geometryCollection(geometries, properties, options) {
if (!geometries) throw new Error('geometries is required');
if (!Array.isArray(geometries)) throw new Error('geometries must be an Array');
return feature({
type: 'GeometryCollection',
geometries: geometries
}, properties, options);
if (options === void 0) { options = {}; }
var geom = {
type: "GeometryCollection",
geometries: geometries,
};
return feature(geom, properties, options);
}
exports.geometryCollection = geometryCollection;
/**

@@ -522,8 +482,10 @@ * Round number to precision

function round(num, precision) {
if (num === undefined || num === null || isNaN(num)) throw new Error('num is required');
if (precision && !(precision >= 0)) throw new Error('precision must be a positive number');
if (precision === void 0) { precision = 0; }
if (precision && !(precision >= 0)) {
throw new Error("precision must be a positive number");
}
var multiplier = Math.pow(10, precision || 0);
return Math.round(num * multiplier) / multiplier;
}
exports.round = round;
/**

@@ -535,14 +497,15 @@ * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.

* @param {number} radians in radians across the sphere
* @param {string} [units='kilometers'] can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers.
* @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres,
* meters, kilometres, kilometers.
* @returns {number} distance
*/
function radiansToLength(radians, units) {
if (radians === undefined || radians === null) throw new Error('radians is required');
if (units && typeof units !== 'string') throw new Error('units must be a string');
var factor = factors[units || 'kilometers'];
if (!factor) throw new Error(units + ' units is invalid');
if (units === void 0) { units = "kilometers"; }
var factor = exports.factors[units];
if (!factor) {
throw new Error(units + " units is invalid");
}
return radians * factor;
}
exports.radiansToLength = radiansToLength;
/**

@@ -554,14 +517,15 @@ * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians

* @param {number} distance in real units
* @param {string} [units='kilometers'] can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers.
* @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres,
* meters, kilometres, kilometers.
* @returns {number} radians
*/
function lengthToRadians(distance, units) {
if (distance === undefined || distance === null) throw new Error('distance is required');
if (units && typeof units !== 'string') throw new Error('units must be a string');
var factor = factors[units || 'kilometers'];
if (!factor) throw new Error(units + ' units is invalid');
if (units === void 0) { units = "kilometers"; }
var factor = exports.factors[units];
if (!factor) {
throw new Error(units + " units is invalid");
}
return distance / factor;
}
exports.lengthToRadians = lengthToRadians;
/**

@@ -573,3 +537,4 @@ * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees

* @param {number} distance in real units
* @param {string} [units='kilometers'] can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers.
* @param {string} [units="kilometers"] can be degrees, radians, miles, or kilometers inches, yards, metres,
* meters, kilometres, kilometers.
* @returns {number} degrees

@@ -580,3 +545,3 @@ */

}
exports.lengthToDegrees = lengthToDegrees;
/**

@@ -591,9 +556,9 @@ * Converts any bearing angle from the north line direction (positive clockwise)

function bearingToAzimuth(bearing) {
if (bearing === null || bearing === undefined) throw new Error('bearing is required');
var angle = bearing % 360;
if (angle < 0) angle += 360;
if (angle < 0) {
angle += 360;
}
return angle;
}
exports.bearingToAzimuth = bearingToAzimuth;
/**

@@ -607,8 +572,6 @@ * Converts an angle in radians to degrees

function radiansToDegrees(radians) {
if (radians === null || radians === undefined) throw new Error('radians is required');
var degrees = radians % (2 * Math.PI);
return degrees * 180 / Math.PI;
}
exports.radiansToDegrees = radiansToDegrees;
/**

@@ -622,8 +585,6 @@ * Converts an angle in degrees to radians

function degreesToRadians(degrees) {
if (degrees === null || degrees === undefined) throw new Error('degrees is required');
var radians = degrees % 360;
return radians * Math.PI / 180;
}
exports.degreesToRadians = degreesToRadians;
/**

@@ -634,13 +595,15 @@ * Converts a length to the requested unit.

* @param {number} length to be converted
* @param {string} originalUnit of the length
* @param {string} [finalUnit='kilometers'] returned unit
* @param {Units} [originalUnit="kilometers"] of the length
* @param {Units} [finalUnit="kilometers"] returned unit
* @returns {number} the converted length
*/
function convertLength(length, originalUnit, finalUnit) {
if (length === null || length === undefined) throw new Error('length is required');
if (!(length >= 0)) throw new Error('length must be a positive number');
return radiansToLength(lengthToRadians(length, originalUnit), finalUnit || 'kilometers');
if (originalUnit === void 0) { originalUnit = "kilometers"; }
if (finalUnit === void 0) { finalUnit = "kilometers"; }
if (!(length >= 0)) {
throw new Error("length must be a positive number");
}
return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
}
exports.convertLength = convertLength;
/**

@@ -650,19 +613,23 @@ * Converts a area to the requested unit.

* @param {number} area to be converted
* @param {string} [originalUnit='meters'] of the distance
* @param {string} [finalUnit='kilometers'] returned unit
* @param {Units} [originalUnit="meters"] of the distance
* @param {Units} [finalUnit="kilometers"] returned unit
* @returns {number} the converted distance
*/
function convertArea(area, originalUnit, finalUnit) {
if (area === null || area === undefined) throw new Error('area is required');
if (!(area >= 0)) throw new Error('area must be a positive number');
var startFactor = areaFactors[originalUnit || 'meters'];
if (!startFactor) throw new Error('invalid original units');
var finalFactor = areaFactors[finalUnit || 'kilometers'];
if (!finalFactor) throw new Error('invalid final units');
if (originalUnit === void 0) { originalUnit = "meters"; }
if (finalUnit === void 0) { finalUnit = "kilometers"; }
if (!(area >= 0)) {
throw new Error("area must be a positive number");
}
var startFactor = exports.areaFactors[originalUnit];
if (!startFactor) {
throw new Error("invalid original units");
}
var finalFactor = exports.areaFactors[finalUnit];
if (!finalFactor) {
throw new Error("invalid final units");
}
return (area / startFactor) * finalFactor;
}
exports.convertArea = convertArea;
/**

@@ -682,3 +649,3 @@ * isNumber

}
exports.isNumber = isNumber;
/**

@@ -698,3 +665,3 @@ * isObject

}
exports.isObject = isObject;
/**

@@ -722,10 +689,18 @@ * Validate BBox

function validateBBox(bbox) {
if (!bbox) throw new Error('bbox is required');
if (!Array.isArray(bbox)) throw new Error('bbox must be an Array');
if (bbox.length !== 4 && bbox.length !== 6) throw new Error('bbox must be an Array of 4 or 6 numbers');
if (!bbox) {
throw new Error("bbox is required");
}
if (!Array.isArray(bbox)) {
throw new Error("bbox must be an Array");
}
if (bbox.length !== 4 && bbox.length !== 6) {
throw new Error("bbox must be an Array of 4 or 6 numbers");
}
bbox.forEach(function (num) {
if (!isNumber(num)) throw new Error('bbox must only contain numbers');
if (!isNumber(num)) {
throw new Error("bbox must only contain numbers");
}
});
}
exports.validateBBox = validateBBox;
/**

@@ -753,71 +728,38 @@ * Validate Id

function validateId(id) {
if (!id) throw new Error('id is required');
if (['string', 'number'].indexOf(typeof id) === -1) throw new Error('id must be a number or a string');
if (!id) {
throw new Error("id is required");
}
if (["string", "number"].indexOf(typeof id) === -1) {
throw new Error("id must be a number or a string");
}
}
exports.validateId = validateId;
// Deprecated methods
function radians2degrees() {
throw new Error('method has been renamed to `radiansToDegrees`');
throw new Error("method has been renamed to `radiansToDegrees`");
}
exports.radians2degrees = radians2degrees;
function degrees2radians() {
throw new Error('method has been renamed to `degreesToRadians`');
throw new Error("method has been renamed to `degreesToRadians`");
}
exports.degrees2radians = degrees2radians;
function distanceToDegrees() {
throw new Error('method has been renamed to `lengthToDegrees`');
throw new Error("method has been renamed to `lengthToDegrees`");
}
exports.distanceToDegrees = distanceToDegrees;
function distanceToRadians() {
throw new Error('method has been renamed to `lengthToRadians`');
throw new Error("method has been renamed to `lengthToRadians`");
}
exports.distanceToRadians = distanceToRadians;
function radiansToDistance() {
throw new Error('method has been renamed to `radiansToLength`');
throw new Error("method has been renamed to `radiansToLength`");
}
exports.radiansToDistance = radiansToDistance;
function bearingToAngle() {
throw new Error('method has been renamed to `bearingToAzimuth`');
throw new Error("method has been renamed to `bearingToAzimuth`");
}
exports.bearingToAngle = bearingToAngle;
function convertDistance() {
throw new Error('method has been renamed to `convertLength`');
throw new Error("method has been renamed to `convertLength`");
}
exports.earthRadius = earthRadius;
exports.factors = factors;
exports.unitsFactors = unitsFactors;
exports.areaFactors = areaFactors;
exports.feature = feature;
exports.geometry = geometry;
exports.point = point;
exports.points = points;
exports.polygon = polygon;
exports.polygons = polygons;
exports.lineString = lineString;
exports.lineStrings = lineStrings;
exports.featureCollection = featureCollection;
exports.multiLineString = multiLineString;
exports.multiPoint = multiPoint;
exports.multiPolygon = multiPolygon;
exports.geometryCollection = geometryCollection;
exports.round = round;
exports.radiansToLength = radiansToLength;
exports.lengthToRadians = lengthToRadians;
exports.lengthToDegrees = lengthToDegrees;
exports.bearingToAzimuth = bearingToAzimuth;
exports.radiansToDegrees = radiansToDegrees;
exports.degreesToRadians = degreesToRadians;
exports.convertLength = convertLength;
exports.convertArea = convertArea;
exports.isNumber = isNumber;
exports.isObject = isObject;
exports.validateBBox = validateBBox;
exports.validateId = validateId;
exports.radians2degrees = radians2degrees;
exports.degrees2radians = degrees2radians;
exports.distanceToDegrees = distanceToDegrees;
exports.distanceToRadians = distanceToRadians;
exports.radiansToDistance = radiansToDistance;
exports.bearingToAngle = bearingToAngle;
exports.convertDistance = convertDistance;
{
"name": "@turf/helpers",
"version": "6.0.1",
"version": "6.1.0",
"description": "turf helpers module",
"main": "index",
"module": "index.mjs",
"types": "index.d.ts",
"files": [
"index.js",
"index.mjs",
"index.d.ts",
"lib"
"index.ts",
"index.d.ts"
],
"scripts": {
"pretest": "rollup -f cjs -o index.js index.mjs",
"prepare": "tsc",
"pretest": "tsc",
"test": "node test.js",

@@ -45,4 +44,4 @@ "bench": "node bench.js",

"tape": "*",
"rollup": "*"
"typescript": "*"
}
}

@@ -23,11 +23,11 @@ # @turf/helpers

Wraps a GeoJSON [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) in a GeoJSON [Feature](https://tools.ietf.org/html/rfc7946#section-3.2).
Wraps a GeoJSON [Geometry][1] in a GeoJSON [Feature][2].
**Parameters**
- `geometry` **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** input geometry
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `geometry` **[Geometry][3]** input geometry
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -47,7 +47,7 @@ **Examples**

Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** a GeoJSON Feature
Returns **[Feature][8]** a GeoJSON Feature
## geometry
Creates a GeoJSON [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) from a Geometry string type & coordinates.
Creates a GeoJSON [Geometry][1] from a Geometry string type & coordinates.
For GeometryCollection type use `helpers.geometryCollection`

@@ -57,6 +57,6 @@

- `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Geometry Type
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** Coordinates
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Geometry
- `type` **[string][7]** Geometry Type
- `coordinates` **[Array][5]&lt;[number][6]>** Coordinates
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Geometry

@@ -74,15 +74,15 @@ **Examples**

Returns **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** a GeoJSON Geometry
Returns **[Geometry][3]** a GeoJSON Geometry
## point
Creates a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) from a Position.
Creates a [Point][9] [Feature][2] from a Position.
**Parameters**
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** longitude, latitude position (each in decimal degrees)
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `coordinates` **[Array][5]&lt;[number][6]>** longitude, latitude position (each in decimal degrees)
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -97,15 +97,15 @@ **Examples**

Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** a Point feature
Returns **[Feature][8]&lt;[Point][10]>** a Point feature
## points
Creates a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) from an Array of Point coordinates.
Creates a [Point][9] [FeatureCollection][11] from an Array of Point coordinates.
**Parameters**
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** an array of Points
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Translate these properties to each Feature (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the FeatureCollection
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the FeatureCollection
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[number][6]>>** an array of Points
- `properties` **[Object][4]** Translate these properties to each Feature (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the FeatureCollection
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the FeatureCollection

@@ -124,15 +124,15 @@ **Examples**

Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** Point Feature
Returns **[FeatureCollection][12]&lt;[Point][10]>** Point Feature
## polygon
Creates a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) from an Array of LinearRings.
Creates a [Polygon][13] [Feature][2] from an Array of LinearRings.
**Parameters**
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>** an array of LinearRings
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[Array][5]&lt;[number][6]>>>** an array of LinearRings
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -147,15 +147,15 @@ **Examples**

Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)>** Polygon Feature
Returns **[Feature][8]&lt;[Polygon][14]>** Polygon Feature
## polygons
Creates a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) from an Array of Polygon coordinates.
Creates a [Polygon][13] [FeatureCollection][11] from an Array of Polygon coordinates.
**Parameters**
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>>** an array of Polygon coordinates
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the FeatureCollection
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[Array][5]&lt;[Array][5]&lt;[number][6]>>>>** an array of Polygon coordinates
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the FeatureCollection

@@ -173,15 +173,15 @@ **Examples**

Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)>** Polygon FeatureCollection
Returns **[FeatureCollection][12]&lt;[Polygon][14]>** Polygon FeatureCollection
## lineString
Creates a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) from an Array of Positions.
Creates a [LineString][15] [Feature][2] from an Array of Positions.
**Parameters**
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** an array of Positions
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[number][6]>>** an array of Positions
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -198,15 +198,15 @@ **Examples**

Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)>** LineString Feature
Returns **[Feature][8]&lt;[LineString][16]>** LineString Feature
## lineStrings
Creates a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) from an Array of LineString coordinates.
Creates a [LineString][15] [FeatureCollection][11] from an Array of LineString coordinates.
**Parameters**
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** an array of LinearRings
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the FeatureCollection
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the FeatureCollection
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[number][6]>>** an array of LinearRings
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the FeatureCollection
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the FeatureCollection

@@ -224,14 +224,14 @@ **Examples**

Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)>** LineString FeatureCollection
Returns **[FeatureCollection][12]&lt;[LineString][16]>** LineString FeatureCollection
## featureCollection
Takes one or more [Features](https://tools.ietf.org/html/rfc7946#section-3.2) and creates a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3).
Takes one or more [Features][2] and creates a [FeatureCollection][11].
**Parameters**
- `features` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)>** input features
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `features` **[Array][5]&lt;[Feature][8]>** input features
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -254,7 +254,7 @@ **Examples**

Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** FeatureCollection of Features
Returns **[FeatureCollection][12]** FeatureCollection of Features
## multiLineString
Creates a [Feature&lt;MultiLineString>](Feature<MultiLineString>) based on a
Creates a [Feature&lt;MultiLineString>][17] based on a
coordinate array. Properties can be added optionally.

@@ -264,7 +264,7 @@

- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>** an array of LineStrings
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[Array][5]&lt;[number][6]>>>** an array of LineStrings
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -279,9 +279,9 @@ **Examples**

- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
- Throws **[Error][18]** if no coordinates are passed
Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5)>** a MultiLineString feature
Returns **[Feature][8]&lt;[MultiLineString][19]>** a MultiLineString feature
## multiPoint
Creates a [Feature&lt;MultiPoint>](Feature<MultiPoint>) based on a
Creates a [Feature&lt;MultiPoint>][20] based on a
coordinate array. Properties can be added optionally.

@@ -291,7 +291,7 @@

- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** an array of Positions
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[number][6]>>** an array of Positions
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -306,9 +306,9 @@ **Examples**

- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
- Throws **[Error][18]** if no coordinates are passed
Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3)>** a MultiPoint feature
Returns **[Feature][8]&lt;[MultiPoint][21]>** a MultiPoint feature
## multiPolygon
Creates a [Feature&lt;MultiPolygon>](Feature<MultiPolygon>) based on a
Creates a [Feature&lt;MultiPolygon>][22] based on a
coordinate array. Properties can be added optionally.

@@ -318,7 +318,7 @@

- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>>** an array of Polygons
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `coordinates` **[Array][5]&lt;[Array][5]&lt;[Array][5]&lt;[Array][5]&lt;[number][6]>>>>** an array of Polygons
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -333,9 +333,9 @@ **Examples**

- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
- Throws **[Error][18]** if no coordinates are passed
Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)>** a multipolygon feature
Returns **[Feature][8]&lt;[MultiPolygon][23]>** a multipolygon feature
## geometryCollection
Creates a [Feature&lt;GeometryCollection>](Feature<GeometryCollection>) based on a
Creates a [Feature&lt;GeometryCollection>][24] based on a
coordinate array. Properties can be added optionally.

@@ -345,7 +345,7 @@

- `geometries` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)>** an array of GeoJSON Geometries
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))?** Identifier associated with the Feature
- `geometries` **[Array][5]&lt;[Geometry][3]>** an array of GeoJSON Geometries
- `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
- `options` **[Object][4]** Optional Parameters (optional, default `{}`)
- `options.bbox` **[Array][5]&lt;[number][6]>?** Bounding Box Array [west, south, east, north] associated with the Feature
- `options.id` **([string][7] \| [number][6])?** Identifier associated with the Feature

@@ -368,3 +368,3 @@ **Examples**

Returns **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)&lt;[GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8)>** a GeoJSON GeometryCollection Feature
Returns **[Feature][8]&lt;[GeometryCollection][25]>** a GeoJSON GeometryCollection Feature

@@ -377,4 +377,4 @@ ## round

- `num` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number
- `precision` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Precision (optional, default `0`)
- `num` **[number][6]** Number
- `precision` **[number][6]** Precision (optional, default `0`)

@@ -391,3 +391,3 @@ **Examples**

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** rounded number
Returns **[number][6]** rounded number

@@ -401,6 +401,6 @@ ## radiansToLength

- `radians` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** in radians across the sphere
- `units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `'kilometers'`)
- `radians` **[number][6]** in radians across the sphere
- `units` **[string][7]** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `'kilometers'`)
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** distance
Returns **[number][6]** distance

@@ -414,6 +414,6 @@ ## lengthToRadians

- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** in real units
- `units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `'kilometers'`)
- `distance` **[number][6]** in real units
- `units` **[string][7]** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `'kilometers'`)
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** radians
Returns **[number][6]** radians

@@ -427,6 +427,6 @@ ## lengthToDegrees

- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** in real units
- `units` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `'kilometers'`)
- `distance` **[number][6]** in real units
- `units` **[string][7]** can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default `'kilometers'`)
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** degrees
Returns **[number][6]** degrees

@@ -440,5 +440,5 @@ ## bearingToAzimuth

- `bearing` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle, between -180 and +180 degrees
- `bearing` **[number][6]** angle, between -180 and +180 degrees
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle between 0 and 360 degrees
Returns **[number][6]** angle between 0 and 360 degrees

@@ -451,5 +451,5 @@ ## radiansToDegrees

- `radians` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle in radians
- `radians` **[number][6]** angle in radians
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** degrees between 0 and 360 degrees
Returns **[number][6]** degrees between 0 and 360 degrees

@@ -462,5 +462,5 @@ ## degreesToRadians

- `degrees` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle between 0 and 360 degrees
- `degrees` **[number][6]** angle between 0 and 360 degrees
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle in radians
Returns **[number][6]** angle in radians

@@ -474,7 +474,7 @@ ## convertLength

- `length` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** to be converted
- `originalUnit` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** of the length
- `finalUnit` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** returned unit (optional, default `'kilometers'`)
- `length` **[number][6]** to be converted
- `originalUnit` **[string][7]** of the length
- `finalUnit` **[string][7]** returned unit (optional, default `'kilometers'`)
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the converted length
Returns **[number][6]** the converted length

@@ -488,7 +488,7 @@ ## convertArea

- `area` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** to be converted
- `originalUnit` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** of the distance (optional, default `'meters'`)
- `finalUnit` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** returned unit (optional, default `'kilometers'`)
- `area` **[number][6]** to be converted
- `originalUnit` **[string][7]** of the distance (optional, default `'meters'`)
- `finalUnit` **[string][7]** returned unit (optional, default `'kilometers'`)
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the converted distance
Returns **[number][6]** the converted distance

@@ -512,3 +512,3 @@ ## isNumber

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false
Returns **[boolean][26]** true/false

@@ -532,4 +532,56 @@ ## isObject

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false
Returns **[boolean][26]** true/false
[1]: https://tools.ietf.org/html/rfc7946#section-3.1
[2]: https://tools.ietf.org/html/rfc7946#section-3.2
[3]: https://tools.ietf.org/html/rfc7946#section-3.1
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[8]: https://tools.ietf.org/html/rfc7946#section-3.2
[9]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[10]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[11]: https://tools.ietf.org/html/rfc7946#section-3.3
[12]: https://tools.ietf.org/html/rfc7946#section-3.3
[13]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[14]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[15]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[16]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[17]: Feature<MultiLineString>
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
[19]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[20]: Feature<MultiPoint>
[21]: https://tools.ietf.org/html/rfc7946#section-3.1.3
[22]: Feature<MultiPolygon>
[23]: https://tools.ietf.org/html/rfc7946#section-3.1.7
[24]: Feature<GeometryCollection>
[25]: https://tools.ietf.org/html/rfc7946#section-3.1.8
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
<!-- This file is automatically generated. Please don't edit it directly:

@@ -536,0 +588,0 @@ if you find an error, edit the source file (likely index.js), and re-run

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc