{"id":20528855,"url":"https://github.com/dkter/stop_tree","last_synced_at":"2025-10-14T05:40:19.563Z","repository":{"id":214671585,"uuid":"737077181","full_name":"dkter/stop_tree","owner":"dkter","description":"download GTFS stops and put them in a k-d tree","archived":false,"fork":false,"pushed_at":"2024-01-06T01:41:19.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-06T02:18:00.659Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/dkter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-12-29T18:39:02.000Z","updated_at":"2024-06-18T22:28:43.000Z","dependencies_parsed_at":"2024-11-15T23:27:44.062Z","dependency_job_id":"c47805e7-4d6c-448c-a486-ba05324141e1","html_url":"https://github.com/dkter/stop_tree","commit_stats":null,"previous_names":["dkter/stop_tree"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dkter/stop_tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkter%2Fstop_tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkter%2Fstop_tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkter%2Fstop_tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkter%2Fstop_tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkter","download_url":"https://codeload.github.com/dkter/stop_tree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkter%2Fstop_tree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018010,"owners_count":26086235,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-15T23:27:37.885Z","updated_at":"2025-10-14T05:40:19.544Z","avatar_url":"https://github.com/dkter.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a quick tool I made to download stops from multiple GTFS feeds, insert them into a k-d tree by latitude and longitude with [kiddo](https://github.com/sdd/kiddo) and save it to a file using [rkyv](https://github.com/rkyv/rkyv). The resulting file can be used as follows -\n\n```rust\nuse std::io::Read;\nuse std::fs::File;\nuse std::path::Path;\nuse kiddo::{KdTree, SquaredEuclidean};\n\n#[derive(Debug, rkyv::Archive, rkyv::Deserialize, rkyv::Serialize, PartialEq)]\nstruct Stop {\n    agency: String,\n    stop_id: String,\n    stop_code: Option\u003cString\u003e,\n    stop_name: String,\n    tts_stop_name: Option\u003cString\u003e,\n    stop_desc: Option\u003cString\u003e,\n    stop_lat: f64,\n    stop_lon: f64,\n    zone_id: Option\u003cString\u003e,\n    stop_url: Option\u003cString\u003e,\n    location_type: Option\u003cString\u003e,\n    parent_station: Option\u003cString\u003e,\n    stop_timezone: Option\u003cString\u003e,\n    wheelchair_boarding: Option\u003cu32\u003e,\n    level_id: Option\u003cString\u003e,\n    platform_code: Option\u003cString\u003e,\n}\n\nfn main() {\n    let args: Vec\u003c_\u003e = std::env::args().collect();\n    let fpath = \u0026args[1];\n    let path = Path::new(\u0026fpath);\n\n    let mut file = File::open(\u0026path).unwrap();\n    let mut bytes = vec![];\n    file.read_to_end(\u0026mut bytes).unwrap();\n    let deserialized = unsafe {\n        rkyv::from_bytes_unchecked::\u003c(Vec\u003cStop\u003e, KdTree\u003cf64, 2\u003e)\u003e(\u0026bytes)\n            .expect(\"Failed to deserialize KdTree\")\n    };\n    let (stops, tree) = deserialized;\n\n    let nearest_n: Vec\u003c_\u003e = tree.nearest_n::\u003cSquaredEuclidean\u003e(\u0026[43.6528525f64,-79.3982886f64], 5);\n    for neighbour in nearest_n {\n        let stop = \u0026stops[neighbour.item as usize];\n        println!(\"{} away  -  {:?}\", neighbour.distance, stop);\n    }\n}\n```\n\nI'm using this to get stops nearby to a specific location in [Departure Board](https://github.com/dkter/departure-board), since all the existing APIs I could find were too slow or unreliable. Keep in mind that this uses the assumption that latitudes/longitudes can be treated as rectangular coordinates on a small scale, which works fine on the scale of bus stops -- however, if your transit system straddles the International Date Line or something things might get weird.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkter%2Fstop_tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkter%2Fstop_tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkter%2Fstop_tree/lists"}