7.2.0 • Published 7 months ago

@turf/length v7.2.0

Weekly downloads
144,868
License
MIT
Repository
github
Last release
7 months ago

@turf/length

length

Takes a GeoJSON and measures its length in the specified units, (Multi)Point's distance are ignored.

Parameters

  • geojson Feature<(LineString | MultiLineString)> GeoJSON to measure
  • options Object Optional parameters (optional, default {})
    • options.units string can be degrees, radians, miles, or kilometers (optional, default kilometers)

Examples

var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
var length = turf.length(line, {units: 'miles'});

//addToMap
var addToMap = [line];
line.properties.distance = length;

Returns number length of GeoJSON


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.

Installation

Install this module individually:

$ npm install @turf/length

Or install the Turf module that includes it as a function:

$ npm install @turf/turf
mapbox-gl-draw-circle-updatedmapbox-gl-draw-circle-with-center-pointgisviewer-vue-ftest1zxmap-ui-supermap@infinitebrahmanuniverse/nolb-_turthing-it-serverlvc-map-components@everything-registry/sub-chunk-941vue-leaflet-measurex-hongtu-utilxbsj-rendererxbsj-xe2superroutevtxf-renderervtxf-xe2v3-core-ui@csnext/cs-map@conveyal/analysis-ui@corpsmap/corpsmap@react-native-flightmap-gl/android@react-native-flightmap-gl/flightmap@react-native-flightmap-gl/maps@rnmapbox/mapsjc-mapbox-gl-draw-circlejmapcloud-ng-terrainjmapcloud-ng-dashboardjoymap-js@hortau/mapsugis-coretqmapoltransportationtongmap-componenttongmap-jsvue-openlayer-sailingmapvue-openlayer-slmapvue-openlayer-slmap1vue-openlayers-dvue-openlayer-darkvue-openlayer-huhongxunvue-openlayer-luoxuvue-openlayer-lxvue-openlayer-mapvue-openlayer-maplxvue-openlayer-mapslvue-openlayervue-openlayer-basevue-openlayer-baseluo@aplinkosministerija/design-system@any-routing/annotation-plugin@big3dev/b3-gis@bmap-turf/turf@cartolab/elements@abi-software/flatmap-viewer@abovesurveying/leaflet-measure@coganalytics/mapbox-gl-draw-geospatial-tools@dhis2/maps-glyymap-turfvue3-openlayer-slmapvue-softpro-uivin3boxzxmap-uizxmap-ui-v2@ediphi/takeoff-models@flightmap-react-native-android/maps@hongtu-next/util@funcate/leaflet-measure-sigweb@geoql/maplibre-gl-draw-circle@giscube/geoportal@globalfishingwatch/layer-composer@ljagis/react-mapping@ljagis/react-mapping-components@larryamiel/peek-maps@loudsrl/turf@letsnova/leaflet-measure@line45/elevation-profiler@mybus/spatial@mpvite/maps@mapbox/carmen@mapbox/carmen-private@mapxus/react-native-mapxus-sdk@mapgis/mapbox-gl-draw-circle@mapgis/mapbox-gl-draw-radius@maplibre/maplibre-react-native@nextgis/leaflet-measure@emuanalytics/flow-rdf-core@emuanalytics/flow-rdf-core-test@dynatrace/strato-geo@jacknkandy/mapbox-gl-draw-circle@oidajs/eo-mobx@oidajs/eo-mobx-react@react-native-mapbox-gl/maps@rdmr-eu/rdf-geopackage@ryry886/mapbox-gl-measure@sabriiot/mapbox-gl-circle-draw@opengis/simple-map@opengis/v3-coremss-mapbox-gl-draw-circlemini-tokyo-3dmy-mapbox-gl-drawoverpass-frontend
7.2.0

7 months ago

7.1.0

11 months ago

7.1.0-alpha.70

11 months ago

7.0.0

1 year ago

7.1.0-alpha.7

1 year ago

7.0.0-alpha.116

1 year ago

7.0.0-alpha.115

1 year ago

7.0.0-alpha.114

1 year ago

7.0.0-alpha.113

1 year ago

7.0.0-alpha.111

1 year ago

7.0.0-alpha.110

2 years ago

7.0.0-alpha.1

2 years ago

7.0.0-alpha.2

2 years ago

7.0.0-alpha.0

3 years ago

6.5.0

4 years ago

6.4.0

4 years ago

6.3.0

4 years ago

6.2.0

4 years ago

6.2.0-alpha.3

5 years ago

6.2.0-alpha.2

5 years ago

6.2.0-alpha.1

5 years ago

6.2.0-alpha.0

5 years ago

6.0.2

7 years ago

6.0.1

7 years ago

6.0.0

7 years ago

5.1.5

8 years ago

5.1.0

8 years ago

5.0.4

8 years ago

5.0.0

8 years ago