turf-distance

WebJar for turf-distance

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

turf-distance
Last Version

Last Version

3.0.12
Release Date

Release Date

Type

Type

jar
Description

Description

turf-distance
WebJar for turf-distance
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Turfjs/turf-distance

Download turf-distance

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/turf-distance/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>turf-distance</artifactId>
    <version>3.0.12</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/turf-distance/
implementation 'org.webjars.npm:turf-distance:3.0.12'
// https://jarcasting.com/artifacts/org.webjars.npm/turf-distance/
implementation ("org.webjars.npm:turf-distance:3.0.12")
'org.webjars.npm:turf-distance:jar:3.0.12'
<dependency org="org.webjars.npm" name="turf-distance" rev="3.0.12">
  <artifact name="turf-distance" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='turf-distance', version='3.0.12')
)
libraryDependencies += "org.webjars.npm" % "turf-distance" % "3.0.12"
[org.webjars.npm/turf-distance "3.0.12"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : turf-invariant jar [3.0.12,4)
org.webjars.npm : turf-helpers jar [3.0.12,4)

Project Modules

There are no modules declared in this project.

DEPRECATED - replaced with @turf/distance

turf-distance

build status

turf distance module

turf.distance(from, to, [units=kilometers])

Calculates the distance between two Point|points in degrees, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature.

Parameters

parameter type description
from Feature.<Point> origin point
to Feature.<Point> destination point
[units=kilometers] String optional: can be degrees, radians, miles, or kilometers

Example

var point1 = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [-75.343, 39.984]
  }
};
var point2 = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [-75.534, 39.123]
  }
};
var units = "miles";

var points = {
  "type": "FeatureCollection",
  "features": [point1, point2]
};

//=points

var distance = turf.distance(point1, point2, units);

//=distance

Returns Number, distance between the two points

Installation

Requires nodejs.

$ npm install turf-distance

Tests

$ npm test
org.webjars.npm

turf

a fast and fully featured open gis engine written in javascript

Versions

Version
3.0.12