{"id":22672257,"url":"https://github.com/jimlynchcodes/route-builder-5000","last_synced_at":"2026-02-08T10:30:56.159Z","repository":{"id":74887870,"uuid":"201793007","full_name":"JimLynchCodes/Route-Builder-5000","owner":"JimLynchCodes","description":"A JavaScript / TypeScript function that calculates the optimal route for a traveling salesman-esque type problem.","archived":false,"fork":false,"pushed_at":"2019-08-11T17:43:45.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-24T12:48:58.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JimLynchCodes.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-08-11T17:10:26.000Z","updated_at":"2019-09-12T15:49:39.000Z","dependencies_parsed_at":"2023-02-26T21:15:50.122Z","dependency_job_id":null,"html_url":"https://github.com/JimLynchCodes/Route-Builder-5000","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JimLynchCodes/Route-Builder-5000","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FRoute-Builder-5000","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FRoute-Builder-5000/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FRoute-Builder-5000/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FRoute-Builder-5000/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JimLynchCodes","download_url":"https://codeload.github.com/JimLynchCodes/Route-Builder-5000/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FRoute-Builder-5000/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29227721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T09:43:19.170Z","status":"ssl_error","status_checked_at":"2026-02-08T09:42:55.556Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-09T16:18:30.453Z","updated_at":"2026-02-08T10:30:56.147Z","avatar_url":"https://github.com/JimLynchCodes.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Route Builder 5000\n\n\n### Playing With The Geolacation API's\n\nBrowers have pretty solid HTML5 support for geolation now. For example, you can open your console right in the browser and type this:\n\n```\nvar g = navigator.geolocation.getCurrentPosition(g =\u003e {\n\tconsole.log('got pos ', g);\n  return g\n},err =\u003e {\n\tconsole.log('didn't get pos ', err);\n  return b\n} )\n```\n\n(Note: make sure to click \"Allow\" when you browser asks if you want to share your location).\n\nThis returns a \"Position\" object, containing a corrdinates object and a timestamp.\n\nFor example:\n```\n{\n  coords: {\n    accuracy: 82,\n    altitude: null\n    altitudeAccuracy: null\n    heading: null\n    latitude: 40.745938599999995\n    longitude: -73.99596989999999\n    speed: null\n  },\n  timestamp: 1565543870672\n}\n```\n\nSince nyc is pretty flat, I think we can take altitude out of the equation and think about each location in terms of the latitude and longitude. Then it's not so much different from looking at the points as if they were x and y coordinates on a regular cartesian plane.\n\n\n\n## The buildRoute Function\n\nThe core function that this service exposes would be called something like, \"buildRoute\", and as parameters it takes multiple destinations. However, things could be a bit more complicated than that. Here are some assumptions that I am making in the calculations here:\n\n- The \"current location\" input represents where the person is physically standing at the current time.\n- There can be an optional \"inital destination\" input. If supplied, the person must go here first.\n- There can be an optional \"final destination\" input. If supplied, the person must end the route here.\n- There can be an optional 0 or more \"intermediate stops\". If supplied, the person must visit all intermediate stops exactly once but in any order.\n\n\nFrom the information above, we can conceive of a function that looks something like this:\n\n```\nstatic buildRoute( initialPersonLocation: Coordinates, intermediateDestinations?: Array\u003cCoordiantes\u003e, initalDestination?: Coordinates, finalDestion?: Coordinates) : RouteObject   \n```\n\nThe output RouteObject could have some information about the total route and then info about each destination.\n\nexample:\n```\n{\n  routeId: 'ASDFASDF',\n  totalLength: '1.1 miles',\n  numberOfDestionations: 5,\n  destionations: [{\n      name: \"Target\",\n      address: \"123 Park Ave:,\n      distanceFromPrevious: '500ft',\n      distanceFromNext: '200ft',\n      thingsToGetThere: [{\n        ...\n      }\n    },\n    ...\n  ]\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Froute-builder-5000","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimlynchcodes%2Froute-builder-5000","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Froute-builder-5000/lists"}