{"id":23428702,"url":"https://github.com/marknjunge/coords","last_synced_at":"2025-04-09T13:19:53.843Z","repository":{"id":110814723,"uuid":"172767346","full_name":"MarkNjunge/coords","owner":"MarkNjunge","description":"A coordinates distance calculator","archived":false,"fork":false,"pushed_at":"2019-02-26T18:34:23.000Z","size":484,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T07:29:07.952Z","etag":null,"topics":[],"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/MarkNjunge.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-26T18:32:05.000Z","updated_at":"2019-02-26T18:34:25.000Z","dependencies_parsed_at":"2023-04-04T08:31:18.748Z","dependency_job_id":null,"html_url":"https://github.com/MarkNjunge/coords","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/MarkNjunge%2Fcoords","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkNjunge%2Fcoords/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkNjunge%2Fcoords/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkNjunge%2Fcoords/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkNjunge","download_url":"https://codeload.github.com/MarkNjunge/coords/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045258,"owners_count":21038557,"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":[],"created_at":"2024-12-23T07:14:30.781Z","updated_at":"2025-04-09T13:19:53.829Z","avatar_url":"https://github.com/MarkNjunge.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coords\n\nA coordinates distance calculator.\n\n## Installation\n\nRequires Node.js\n\n- Clone the repository `git clone https://github.com/MarkNjunge/coords.git`\n- Run using `npm start`.\n\nYou can change the port using the `PORT` environment variable.\n\n## Routes\n\n### Distance between coordinates\n\nCalculates the distance (in km) between two coordinates.\n\n`/distance?lat1={latitude-1}\u0026lng1={longitude-1}\u0026lat2={latitude-2}\u0026lng2={longitude-1}`  \ne.g. http://localhost:3000/distance?lat1=-1.28333\u0026lng1=36.81667\u0026lat2=-4.036878\u0026lng2=39.669571\n\n**Response**\n\n```Json\n{\n  \"distance\": 440.6177\n}\n```\n\n### Bounding box\n\nReturns a bounding box given distance and center point (coordinates). The result will have width of `2 * inradius`.\n\n`/bounds?lat={latitude}\u0026lng={longitude}\u0026inradius={inradius}`  \ne.g. http://localhost:3000/bounds?lat=-1.286557\u0026lng=36.817374\u0026inradius=50\n\n**Response**\n\n```Json\n{\n  \"extremes\": {\n    \"lat\": {\n      \"max\": -0.8361,\n      \"min\": -1.7371\n    },\n    \"lng\": {\n      \"max\": 37.2672,\n      \"min\": 36.3676\n    }\n  },\n  \"bounds\": {\n    \"topRight\": {\n      \"lat\": -0.8361,\n      \"lng\": 37.2672\n    },\n    \"bottomRight\": {\n      \"lat\": -1.7371,\n      \"lng\": 37.2672\n    },\n    \"bottomLeft\": {\n      \"lat\": -1.7371,\n      \"lng\": 36.3676\n    },\n    \"topLeft\": {\n      \"lat\": -0.8361,\n      \"lng\": 36.3676\n    }\n  }\n}\n```\n\n\u003ch1 align=\"center\"\u003e\n\t\u003cimg\n\t\twidth=\"500\"\n\t\talt=\"Banner\"\n\t\tsrc=\"img/1.png\"\u003e\n\u003c/h1\u003e\n\n#### Wrapping\n\nA wrap paremeter an also be added to the request to support requests near the [antimeridian](https://en.wikipedia.org/wiki/180th_meridian).\n\nIt will split the bouding box into two seperate boxes. _See image below_\n\n`/bounds?lat={latitude}\u0026lng={longitude}\u0026inradius={inradius}\u0026wrap={wrap}`  \ne.g. http://localhost:3000/bounds?lat=65.601221\u0026lng=-173.766828\u0026inradius=500\u0026wrap=true\n\n**Response**\n\n```Json\n[\n  {\n    \"extremes\": {\n      \"lat\": {\n        \"max\": 70.1057,\n        \"min\": 61.0967\n      },\n      \"lng\": {\n        \"max\": 180,\n        \"min\": 175.3478\n      }\n    },\n    \"bounds\": {\n      \"topRight\": {\n        \"lat\": 70.1057,\n        \"lng\": 180\n      },\n      \"bottomRight\": {\n        \"lat\": 61.0967,\n        \"lng\": 180\n      },\n      \"bottomLeft\": {\n        \"lat\": 61.0967,\n        \"lng\": 175.3478\n      },\n      \"topLeft\": {\n        \"lat\": 70.1057,\n        \"lng\": 175.3478\n      }\n    }\n  },\n  {\n    \"extremes\": {\n      \"lat\": {\n        \"max\": 70.1057,\n        \"min\": 61.0967\n      },\n      \"lng\": {\n        \"max\": -162.8814,\n        \"min\": -180\n      }\n    },\n    \"bounds\": {\n      \"topRight\": {\n        \"lat\": 70.1057,\n        \"lng\": -162.8814\n      },\n      \"bottomRight\": {\n        \"lat\": 61.0967,\n        \"lng\": -162.8814\n      },\n      \"bottomLeft\": {\n        \"lat\": 61.0967,\n        \"lng\": -180\n      },\n      \"topLeft\": {\n        \"lat\": 70.1057,\n        \"lng\": -180\n      }\n    }\n  }\n]\n```\n\n\u003ch1 align=\"center\"\u003e\n\t\u003cimg\n\t\twidth=\"500\"\n\t\talt=\"Banner\"\n\t\tsrc=\"img/2.png\"\u003e\n\u003c/h1\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarknjunge%2Fcoords","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarknjunge%2Fcoords","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarknjunge%2Fcoords/lists"}