{"id":24501817,"url":"https://github.com/py-b/osmbus","last_synced_at":"2026-05-03T07:34:19.566Z","repository":{"id":183408563,"uuid":"144835895","full_name":"py-b/osmbus","owner":"py-b","description":"Export OpenStreetMap Bus Lines to GPX","archived":false,"fork":false,"pushed_at":"2020-11-16T09:10:14.000Z","size":170,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T19:48:04.079Z","etag":null,"topics":["bus","gpx","openstreetmap","osm","r","rstats","rstats-package"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/py-b.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-08-15T09:50:18.000Z","updated_at":"2020-12-13T08:27:04.000Z","dependencies_parsed_at":"2023-07-24T11:10:26.060Z","dependency_job_id":null,"html_url":"https://github.com/py-b/osmbus","commit_stats":null,"previous_names":["py-b/osmbus"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/py-b/osmbus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-b%2Fosmbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-b%2Fosmbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-b%2Fosmbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-b%2Fosmbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/py-b","download_url":"https://codeload.github.com/py-b/osmbus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py-b%2Fosmbus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32562118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"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":["bus","gpx","openstreetmap","osm","r","rstats","rstats-package"],"created_at":"2025-01-21T22:45:52.432Z","updated_at":"2026-05-03T07:34:19.551Z","avatar_url":"https://github.com/py-b.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n\u003c!-- badges: start --\u003e\n[![R build status](https://github.com/py-b/osmbus/workflows/R-CMD-check/badge.svg)](https://github.com/py-b/osmbus/actions)\n[![CRAN status](https://www.r-pkg.org/badges/version/osmbus)](https://cran.r-project.org/package=osmbus)\n\u003c!-- badges: end --\u003e\n  \n# osmbus\n\n**osmbus** is an R package which exports [OpenStreetMap](https://www.openstreetmap.org)\n(OSM) public transport lines to GPX files.\n\nIt works with OSM _relations_ containing the following tags :\n\n * `type` = `route`\n * `route` = `aerialway|bus|ferry|monorail|subway|train|tram|trolleybus`\n\nYou can install the package from GitHub with :\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"py-b/osmbus\")\n```\n\n### Just give me my GPX file\n\nThe only mandatory argument is the OSM identifier of the transport line. For\ninstance, to export [this bus line](https://www.openstreetmap.org/relation/3220296)\n(in Nancy, France) :\n\n```r\nwrite_gpx(id_rel = \"3220296\")\n```\n\nThe data coming from the OSM server must be clean for the export to work.\n\nAs stated in the OSM documentation, the ways in the relation should be listed\nbeginning with the way at the initial stop position and ending with the way at\nthe terminal stop, in the right order. The package will automatically reverse\nsome ways to produce a continuous track.\n\nIf roundabouts (or any circular ways) are part of the track, **osmbus** will\nfind its way through them, i.e. it will select the only nodes used by the\ntransport vehicle from entrance to exit.\n\n##### Content of the output file\n\n- transport line metadata : some retrieved from OSM (for example the\n  version of the relation) and some calculated by the package (for example the\n  length in kilometers) ;\n- coordinates and names of the stops (`role=stop` in the relation), as `wpt(s)`\n  elements ;\n- list of the track points in the correct order, as a `trkseg` element.\n\nIt will be structured like this :\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cgpx\u003e\n  \u003cmetadata\u003e\n    \u003cosm_relation id=\"3220296\" version=\"79\" timestamp=\"2020-11-08T17:23:43Z\"\u003e\n      \u003ccolour\u003e#20B14A\u003c/colour\u003e\n      \u003cfrom\u003eSeichamps Haie Cerlin\u003c/from\u003e\n      \u003cname\u003eTempo 3 : Seichamps Haie Cerlin → Villers Campus Sciences\u003c/name\u003e\n      \u003cnetwork\u003eStan\u003c/network\u003e\n      \u003coperator\u003eTransdev\u003c/operator\u003e\n      \u003cref\u003eTempo 3\u003c/ref\u003e\n      \u003croute\u003ebus\u003c/route\u003e\n      \u003cto\u003eVillers Campus Sciences\u003c/to\u003e\n      \u003ctype\u003eroute\u003c/type\u003e\n    \u003c/osm_relation\u003e\n    \u003cbounds minlat=\"48.6634437\" minlon=\"6.1424778\" maxlat=\"48.7196149\" maxlon=\"6.2695481\"/\u003e\n    \u003cwpt_count\u003e46\u003c/wpt_count\u003e\n    \u003ctrkpt_count\u003e946\u003c/trkpt_count\u003e\n    \u003ctrk_km\u003e17.383\u003c/trk_km\u003e\n    \u003ccopyright attribution=\"http://www.openstreetmap.org/copyright\"/\u003e\n  \u003c/metadata\u003e\n  \u003cwpt lat=\"48.7195418\" lon=\"6.2657901\" osm_node=\"3163674258\" version=\"1\"\u003e\n    \u003cname\u003eSeichamps Haie Cerlin\u003c/name\u003e\n  \u003c/wpt\u003e\n  \u003cwpt lat=\"48.7169089\" lon=\"6.2656034\" osm_node=\"3163519911\" version=\"1\"\u003e\n    \u003cname\u003eSeichamps Église\u003c/name\u003e\n  \u003c/wpt\u003e\n  \u003c!-- .... other way points ... --\u003e\n  \u003cwpt lat=\"48.6635161\" lon=\"6.1561497\" osm_node=\"1650185781\" version=\"6\"\u003e\n    \u003cname\u003eVillers Campus Sciences\u003c/name\u003e\n  \u003c/wpt\u003e\n  \u003ctrk\u003e\n    \u003ctrkseg\u003e\n      \u003ctrkpt lat=\"48.7195418\" lon=\"6.2657901\" osm_node=\"3163674258\" version=\"1\"/\u003e\n      \u003ctrkpt lat=\"48.7195728\" lon=\"6.2657585\" osm_node=\"3163674481\" version=\"2\"/\u003e\n      \u003ctrkpt lat=\"48.71959\" lon=\"6.2657147\" osm_node=\"3070509280\" version=\"3\"/\u003e\n      \u003c!-- ... other track points ... --\u003e\n      \u003ctrkpt lat=\"48.663529\" lon=\"6.1559462\" osm_node=\"4455689648\" version=\"1\"/\u003e\n      \u003ctrkpt lat=\"48.6635161\" lon=\"6.1561497\" osm_node=\"1650185781\" version=\"6\"/\u003e\n    \u003c/trkseg\u003e\n  \u003c/trk\u003e\n\u003c/gpx\u003e\n```\n\nAttributes of OSM objects (`osm_node` and `version`) can be ommited in the file\nby setting `osm_info = FALSE`.\n\n##### Example of use\n\nWith the gpx file, you are a few steps away from creating a map like\n[this](http://u.osmfr.org/m/218270).\n\n\u003ca href=\"http://u.osmfr.org/m/218270/\"\u003e![](example_of_use.jpg)\u003c/a\u003e\n\n_(this map was not made with R but with an interactive tool called\n[uMap](http://umap.openstreetmap.fr))_\n\n### Get the underlying data into R\n\nIt is also possible to get the intermediate data that was used to generate the\ngpx file (this can be useful to do something else than exporting to GPX).\n\n``` r\nextract_data(id_rel = \"3220296\")\n#\u003e $bounds\n#\u003e    minlat    minlon    maxlat    maxlon \n#\u003e 48.663444  6.142478 48.719615  6.269548 \n#\u003e \n#\u003e $rel_tags\n#\u003e                                                      colour \n#\u003e                                                   \"#20B14A\" \n#\u003e                                                        from \n#\u003e                                     \"Seichamps Haie Cerlin\" \n#\u003e                                                        name \n#\u003e \"Tempo 3 : Seichamps Haie Cerlin → Villers Campus Sciences\" \n#\u003e                                                     network \n#\u003e                                                      \"Stan\" \n#\u003e                                                    operator \n#\u003e                                                  \"Transdev\" \n#\u003e                                                         ref \n#\u003e                                                   \"Tempo 3\" \n#\u003e                                                       route \n#\u003e                                                       \"bus\" \n#\u003e                                                          to \n#\u003e                                   \"Villers Campus Sciences\" \n#\u003e                                                        type \n#\u003e                                                     \"route\" \n#\u003e \n#\u003e $rel_attr\n#\u003e                     id                version              timestamp \n#\u003e              \"3220296\"                   \"79\" \"2020-11-08T17:23:43Z\" \n#\u003e              changeset                    uid                   user \n#\u003e             \"93750625\"              \"1075986\"           \"py_berrard\" \n#\u003e \n#\u003e $stop_count\n#\u003e [1] 46\n#\u003e \n#\u003e $trkpt_count\n#\u003e [1] 946\n#\u003e \n#\u003e $trk_km\n#\u003e [1] 17.383\n#\u003e \n#\u003e $stop_base\n#\u003e # A tibble: 46 x 5\n#\u003e    id         name                    lat   lon version\n#\u003e    \u003cchr\u003e      \u003cchr\u003e                 \u003cdbl\u003e \u003cdbl\u003e \u003cchr\u003e  \n#\u003e  1 3163674258 Seichamps Haie Cerlin  48.7  6.27 1      \n#\u003e  2 3163519911 Seichamps Église       48.7  6.27 1      \n#\u003e  3 966281833  Donon                  48.7  6.27 2      \n#\u003e  4 3163208966 Jardin Roussel         48.7  6.27 1      \n#\u003e  5 3140811791 Semoir                 48.7  6.26 1      \n#\u003e  6 963538950  Collège Goncourt       48.7  6.26 2      \n#\u003e  7 3065252842 Blés d'Or              48.7  6.26 2      \n#\u003e  8 962186695  Charles de Gaulle      48.7  6.25 3      \n#\u003e  9 3414202098 Renaissance            48.7  6.25 2      \n#\u003e 10 3138716806 Porte Verte            48.7  6.24 2      \n#\u003e # ... with 36 more rows\n#\u003e \n#\u003e $trkpt_base\n#\u003e # A tibble: 946 x 5\n#\u003e    id           lat   lon version d_last\n#\u003e    \u003cchr\u003e      \u003cdbl\u003e \u003cdbl\u003e \u003cchr\u003e    \u003cdbl\u003e\n#\u003e  1 3163674258  48.7  6.27 1         0   \n#\u003e  2 3163674481  48.7  6.27 2         4.16\n#\u003e  3 3070509280  48.7  6.27 3         3.74\n#\u003e  4 3163674482  48.7  6.27 2         6.68\n#\u003e  5 3070509345  48.7  6.27 3         4.95\n#\u003e  6 65074447    48.7  6.27 3        12.7 \n#\u003e  7 3163674477  48.7  6.27 2        23.3 \n#\u003e  8 3163674476  48.7  6.27 1         2.94\n#\u003e  9 4720935403  48.7  6.26 1        88.5 \n#\u003e 10 4720935406  48.7  6.26 1         5.41\n#\u003e # ... with 936 more rows\n```\n\n_(`d_last` in the `trkpt_base` data.frame gives the distance to the previous\npoint, in meters)_\n\n\u003e If you wish to both export to a file and keep the data, you can affect the\n\u003e result of `write_gpx()` to an objet :\n\u003e ```r\n\u003e bus_data \u003c- write_gpx(id_rel = \"3220296\")\n\u003e ```\n\n### Overpass API\n\nThe data is retrieved from OpenStreetMap using the\n[overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API).\n\nYou can choose which instance of the API is used via the `overpass_url` argument\nof the functions. By default, the main instance `\"http://overpass-api.de/api/interpreter\"`\nis used. See the link above for a list of available instances.\n\nNote that this read-only API can be a few minutes behind the editing API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy-b%2Fosmbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpy-b%2Fosmbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy-b%2Fosmbus/lists"}