block by aemkei 1163223

Latitude Longitude Distance - 140byt.es

Latitude Longitude Distance - 140byt.es

This uses the Haversine formula to calculate the great-circle distance between two points.

Usage

distanceLatLng (
  latitude1, longitude1, // first coordinates
  latitude2, longitude2, // seconds coordinates
  diameter // earth diameter (might be any unit)
)

// returns the distance in the specified unit

Earth Diameter

Author

Created by Martin Kleppe (@aemkei) at Ubilabs.

DIY

Check his “JavaScript Golf Lessons“ slides.

For more information

See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.

index.js

LICENSE.txt

annotated.js

package.json

test.html