Gathering detailed insights and metrics for milafrerichs-turf-helpers
Gathering detailed insights and metrics for milafrerichs-turf-helpers
npm install milafrerichs-turf-helpers
Typescript
Module System
74.9
Supply Chain
99.4
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (86.87%)
JavaScript (13.12%)
Shell (0.01%)
Total Downloads
1,784
Last Day
1
Last Week
4
Last Month
30
Last Year
149
9,523 Stars
3,736 Commits
952 Forks
182 Watching
48 Branches
168 Contributors
Minified
Minified + Gzipped
Latest Version
6.0.4
Package Id
milafrerichs-turf-helpers@6.0.4
Unpacked Size
97.29 kB
Size
11.94 kB
File Count
9
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-60%
4
Compared to previous week
Last month
233.3%
30
Compared to previous month
Last year
-22.8%
149
Compared to previous year
Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
Units of measurement factors based on 1 meter.
Area of measurement factors based on 1 square meter.
Wraps a GeoJSON Geometry in a GeoJSON Feature.
Parameters
geometry
Geometry input geometryproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var geometry = { 2 "type": "Point", 3 "coordinates": [110, 50] 4}; 5 6var feature = turf.feature(geometry); 7 8//=feature
Returns Feature a GeoJSON Feature
Creates a GeoJSON Geometry from a Geometry string type & coordinates.
For GeometryCollection type use helpers.geometryCollection
Parameters
type
string Geometry Typecoordinates
Array<number> Coordinatesoptions
Object Optional Parameters (optional, default {}
)
Examples
1var type = 'Point'; 2var coordinates = [110, 50]; 3 4var geometry = turf.geometry(type, coordinates); 5 6//=geometry
Returns Geometry a GeoJSON Geometry
Creates a Point Feature from a Position.
Parameters
coordinates
Array<number> longitude, latitude position (each in decimal degrees)properties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var point = turf.point([-75.343, 39.984]); 2 3//=point
Returns Feature<Point> a Point feature
Creates a Point FeatureCollection from an Array of Point coordinates.
Parameters
coordinates
Array<Array<number>> an array of Pointsproperties
Object Translate these properties to each Feature (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var points = turf.points([ 2 [-75, 39], 3 [-80, 45], 4 [-78, 50] 5]); 6 7//=points
Returns FeatureCollection<Point> Point Feature
Creates a Polygon Feature from an Array of LinearRings.
Parameters
coordinates
Array<Array<Array<number>>> an array of LinearRingsproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' }); 2 3//=polygon
Returns Feature<Polygon> Polygon Feature
Creates a Polygon FeatureCollection from an Array of Polygon coordinates.
Parameters
coordinates
Array<Array<Array<Array<number>>>> an array of Polygon coordinatesproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var polygons = turf.polygons([ 2 [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], 3 [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]], 4]); 5 6//=polygons
Returns FeatureCollection<Polygon> Polygon FeatureCollection
Creates a LineString Feature from an Array of Positions.
Parameters
coordinates
Array<Array<number>> an array of Positionsproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'}); 2var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'}); 3 4//=linestring1 5//=linestring2
Returns Feature<LineString> LineString Feature
Creates a LineString FeatureCollection from an Array of LineString coordinates.
Parameters
coordinates
Array<Array<number>> an array of LinearRingsproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var linestrings = turf.lineStrings([ 2 [[-24, 63], [-23, 60], [-25, 65], [-20, 69]], 3 [[-14, 43], [-13, 40], [-15, 45], [-10, 49]] 4]); 5 6//=linestrings
Returns FeatureCollection<LineString> LineString FeatureCollection
Takes one or more Features and creates a FeatureCollection.
Parameters
Examples
1var locationA = turf.point([-75.343, 39.984], {name: 'Location A'}); 2var locationB = turf.point([-75.833, 39.284], {name: 'Location B'}); 3var locationC = turf.point([-75.534, 39.123], {name: 'Location C'}); 4 5var collection = turf.featureCollection([ 6 locationA, 7 locationB, 8 locationC 9]); 10 11//=collection
Returns FeatureCollection FeatureCollection of Features
Creates a Feature<MultiLineString> based on a coordinate array. Properties can be added optionally.
Parameters
coordinates
Array<Array<Array<number>>> an array of LineStringsproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var multiLine = turf.multiLineString([[[0,0],[10,10]]]); 2 3//=multiLine
Returns Feature<MultiLineString> a MultiLineString feature
Creates a Feature<MultiPoint> based on a coordinate array. Properties can be added optionally.
Parameters
coordinates
Array<Array<number>> an array of Positionsproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var multiPt = turf.multiPoint([[0,0],[10,10]]); 2 3//=multiPt
Returns Feature<MultiPoint> a MultiPoint feature
Creates a Feature<MultiPolygon> based on a coordinate array. Properties can be added optionally.
Parameters
coordinates
Array<Array<Array<Array<number>>>> an array of Polygonsproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]); 2 3//=multiPoly
Returns Feature<MultiPolygon> a multipolygon feature
Creates a Feature<GeometryCollection> based on a coordinate array. Properties can be added optionally.
Parameters
geometries
Array<Geometry> an array of GeoJSON Geometriesproperties
Object an Object of key-value pairs to add as properties (optional, default {}
)options
Object Optional Parameters (optional, default {}
)
Examples
1var pt = { 2 "type": "Point", 3 "coordinates": [100, 0] 4 }; 5var line = { 6 "type": "LineString", 7 "coordinates": [ [101, 0], [102, 1] ] 8 }; 9var collection = turf.geometryCollection([pt, line]); 10 11//=collection
Returns Feature<GeometryCollection> a GeoJSON GeometryCollection Feature
Round number to precision
Parameters
Examples
1turf.round(120.4321) 2//=120 3 4turf.round(120.4321, 2) 5//=120.43
Returns number rounded number
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
Parameters
radians
number in radians across the sphereunits
string can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default 'kilometers'
)Returns number distance
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
Parameters
distance
number in real unitsunits
string can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default 'kilometers'
)Returns number radians
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
Parameters
distance
number in real unitsunits
string can be degrees, radians, miles, or kilometers inches, yards, metres, meters, kilometres, kilometers. (optional, default 'kilometers'
)Returns number degrees
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
Parameters
bearing
number angle, between -180 and +180 degreesReturns number angle between 0 and 360 degrees
Converts an angle in radians to degrees
Parameters
radians
number angle in radiansReturns number degrees between 0 and 360 degrees
Converts an angle in degrees to radians
Parameters
degrees
number angle between 0 and 360 degreesReturns number angle in radians
Converts a length to the requested unit. Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet
Parameters
length
number to be convertedoriginalUnit
string of the lengthfinalUnit
string returned unit (optional, default 'kilometers'
)Returns number the converted length
Converts a area to the requested unit. Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches
Parameters
area
number to be convertedoriginalUnit
string of the distance (optional, default 'meters'
)finalUnit
string returned unit (optional, default 'kilometers'
)Returns number the converted distance
isNumber
Parameters
num
any Number to validateExamples
1turf.isNumber(123) 2//=true 3turf.isNumber('foo') 4//=false
Returns boolean true/false
isObject
Parameters
input
any variable to validateExamples
1turf.isObject({elevation: 10}) 2//=true 3turf.isObject('foo') 4//=false
Returns boolean true/false
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
1$ npm install @turf/helpers
Or install the Turf module that includes it as a function:
1$ npm install @turf/turf
No vulnerabilities found.
Reason
30 commit(s) and 18 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
project is fuzzed
Details
Reason
Found 9/10 approved changesets -- score normalized to 9
Reason
4 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More