{"id":20819876,"url":"https://github.com/brandon93s/haversine-js","last_synced_at":"2025-05-07T15:23:47.339Z","repository":{"id":56098202,"uuid":"81888668","full_name":"brandon93s/haversine-js","owner":"brandon93s","description":"JavaScript implementation of the Haversine formula","archived":false,"fork":false,"pushed_at":"2020-11-25T14:05:54.000Z","size":65,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-18T04:13:24.351Z","etag":null,"topics":["circle-distance","haversine-formula","latitude","longitude","radius","sphere"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brandon93s.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-14T01:02:36.000Z","updated_at":"2022-10-06T08:49:25.000Z","dependencies_parsed_at":"2022-08-15T13:10:21.819Z","dependency_job_id":null,"html_url":"https://github.com/brandon93s/haversine-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fhaversine-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fhaversine-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fhaversine-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fhaversine-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandon93s","download_url":"https://codeload.github.com/brandon93s/haversine-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252903459,"owners_count":21822450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circle-distance","haversine-formula","latitude","longitude","radius","sphere"],"created_at":"2024-11-17T22:07:42.476Z","updated_at":"2025-05-07T15:23:47.311Z","avatar_url":"https://github.com/brandon93s.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# haversine-js [![Build Status](https://travis-ci.org/brandon93s/haversine-js.svg?branch=master)](https://travis-ci.org/brandon93s/haversine-js)\n\n\u003e Implementation of the [haversine formula](https://en.wikipedia.org/wiki/Haversine_formula \"Haversine Formula\") to calculate the [great-circle distance](https://en.wikipedia.org/wiki/Great-circle_distance \"great-circle distance\") between two points on a sphere given their longitudes and latitudes  :earth_americas:\n\n\n## Install\n\n```\n$ npm install --save haversine-js\n\n```\n\n\n## Usage\n\n```js\nconst haversine = require('haversine-js');\n\nconst atlanta = {\n  latitude: 33.7490,\n  longitude: -84.3880\n};\n\nconst london = {\n  latitude: 51.5074,\n  longitude: -0.1278\n};\n\nconst options = {\n    radius: haversine.EARTH.MILE\n};\n\nhaversine(atlanta, london, options).toFixed(0);\n//=\u003e 4207\n```\n\n\n## API\n\n### haversine(start, end, [,options])\n\n#### start, end\n\nType: `object`\n\nObject containing the longitude/latitude coordinate pair for either point.\n\n```js\nconst start = {\n    longitude: 33.7490,\n    latitude: 84.3880\n};\n```\n\n\n#### options\n\n##### radius\n\nType: `number`\u003cbr\u003e\nDefault: `haversine.EARTH.MILE`\n\nThe radius of the sphere.\n\n##### isRadians\n\nType: `boolean` \u003cbr\u003e\nDefault: `false`\n\nSet to true if the longitude/latitude values are in radians.\n\n\n## Constants\n\n### Radii\n\n| Constant        | Value\n| -------------   |:-------------:|\n| EARTH.MILE      | 3959 |\n| EARTH.KM        | 6371      |\n| EARTH.M         | 6371000     |\n| EARTH.NMI       | 3440     |\n\n\n## License\n\nMIT © [Brandon Smith](https://github.com/brandon93s)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandon93s%2Fhaversine-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandon93s%2Fhaversine-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandon93s%2Fhaversine-js/lists"}