6.5.0 • Published 16 days ago

@turf/length v6.5.0

Weekly downloads
144,868
License
MIT
Repository
github
Last release
16 days 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-941libre-routinghongtu-utillautec-leaflet-measureleaflet-measureleaflet-measure-exleaflet-measure-extleaflet-measure-v2jc-mapbox-gl-draw-circlejoymap-jsluke.glmappls-map-react-nativemss-mapbox-gl-draw-circlehowfarnbmap-glneonmaps-search-addressmy-mapbox-gl-drawmapbox-measuremapbox-measuresmaplibre-gl-draw-circlemaplibre-gl-draw-circle-custommaplibre-gl-js-amplifymapmyindia-map-react-native-betamapbox-extensionsmapbox-gl-draw-rounded-circlemapbox-gl-draw-circlemapbox-gl-draw-circle-modemapbox-gl-draw-circle-modesmapbox-gl-draw-circle2mini-tokyo-3d@hortau/mapsgt-mapbox-gl-draw-circlehalicarnassusharperdbharperdb-32harperdb-armv7harperdb-x86fengsheng-rnmapsgeojson-split-crossing-linesgeojson-statgeoverviewgisviewer-vuegisviewer-vue-cdgisviewer-vue-ftestgisviewer-vue2-cesiumgas3d.gl@ttfn/mapbox-gl-draw@tuliu/tuliu-base-map@track-asia/trackasia-react-native@zoupers/vue-iclient-mapboxglproximiio-js-library@tristanhoffmann/leaflet-measure@ttungbmt/leaflet-measureosm-search-data-exportosmlinter@vtmap/vtmap-react-native-sdk@wabson/mapbox-gl-feature-infoagentmaps@zalastax/nolb-_turambulances@abovesurveying/leaflet-measureoverpass-frontendoverpass-layer@any-routing/annotation-pluginarlas-web-componentspelias-polylinepinme_backendalt-route-labeller@cartolab/elements@conveyal/analysis-uisearoute-jssearoute-tscat-net-pro-mapbox-gl-draw-circlesecusoft-map@coganalytics/mapbox-gl-draw-geospatial-toolszxmap-uizxmap-ui-v2@ediphi/takeoff-models@globalfishingwatch/layer-composer@emuanalytics/flow-rdf-core@emuanalytics/flow-rdf-core-test@flightmap-react-native-android/maps@funcate/leaflet-measure-sigwebvue-openlayer-mapvue-openlayer-maplxvue-openlayer-mapslvue-openlayer-sailingmapvue-openlayer-slmapvue-openlayer-slmap1vue-openlayers-dvue-openlayervue-openlayer-basevue-openlayer-baseluo
7.0.0-alpha.114

16 days ago

7.0.0-alpha.113

2 months ago

7.0.0-alpha.111

2 months ago

7.0.0-alpha.110

3 months ago

7.0.0-alpha.1

6 months ago

7.0.0-alpha.2

6 months ago

7.0.0-alpha.0

1 year ago

6.5.0

3 years ago

6.4.0

3 years ago

6.3.0

3 years ago

6.2.0

3 years ago

6.2.0-alpha.3

3 years ago

6.2.0-alpha.2

4 years ago

6.2.0-alpha.1

4 years ago

6.2.0-alpha.0

4 years ago

6.0.2

6 years ago

6.0.1

6 years ago

6.0.0

6 years ago

5.1.5

6 years ago

5.1.0

6 years ago

5.0.4

6 years ago

5.0.0

6 years ago