{"id":28441035,"url":"https://github.com/seeebiii/osm-routing-examples","last_synced_at":"2025-09-10T19:37:10.650Z","repository":{"id":85395057,"uuid":"71562909","full_name":"seeebiii/osm-routing-examples","owner":"seeebiii","description":"Contains examples how to read and route with OSM.","archived":false,"fork":false,"pushed_at":"2017-03-31T08:04:51.000Z","size":535,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-29T00:47:14.993Z","etag":null,"topics":["osm","osm-pbf","routing","routing-algorithm"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/seeebiii.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,"zenodo":null}},"created_at":"2016-10-21T12:24:34.000Z","updated_at":"2024-07-29T08:40:51.000Z","dependencies_parsed_at":"2023-03-04T05:00:30.794Z","dependency_job_id":null,"html_url":"https://github.com/seeebiii/osm-routing-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seeebiii/osm-routing-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seeebiii%2Fosm-routing-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seeebiii%2Fosm-routing-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seeebiii%2Fosm-routing-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seeebiii%2Fosm-routing-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seeebiii","download_url":"https://codeload.github.com/seeebiii/osm-routing-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seeebiii%2Fosm-routing-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274512760,"owners_count":25299519,"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-09-10T02:00:12.551Z","response_time":83,"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":["osm","osm-pbf","routing","routing-algorithm"],"created_at":"2025-06-06T04:08:48.585Z","updated_at":"2025-09-10T19:37:10.622Z","avatar_url":"https://github.com/seeebiii.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# osm-routing-examples\nA playground containing examples how to read OSM data and calculate routes. Also provides a basic Swing \napplication for routing and a website to for routing and finding POIs.\n\n## Author\nSebastian Hesse\n\n## Requirements\n\n##### Java \u0026 Maven\nYou need JDK 8 to compile the sources (or JRE 8 to run them). Download it\n[here](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html).\nAdditionally [Maven](https://maven.apache.org/) must be installed on your system.\n\n##### OSM files\nYou can download OSM files for Germany (and other areas as well) on [this website](http://download.geofabrik.de/).\n\n##### Location Code List and Event Code List\nIn order to use the TMC support, you need a LCL and ECL file. This can be\nrequested [here for Germany](https://www.bast.de/DE/Verkehrstechnik/Fachthemen/v2-LCL/location-code-list_node.html).\n\n##### TMC data\nYou need some TMC data files. Each file should have the format ```*HH.dat```, e.g. 20170101-19.dat for the time slot\n19:00 - 19:59 on the day 01.01.2017. As you can see, only full hours are supported. The application will also\nsave an optimized version of the file with the format ```*HH.dat.cdat``` to the same directory. This improves the\nloading of TMC data, because not all data is relevant. If there occur any errors, it might be possible that the user\nwho is executing the application has not enough rights to write into that folder.\n\n\n## Examples\n![Browser view of the routing website](/docu/img/browser_view.jpg \"Browser View\")\n\nHere are some example classes for different use cases.\n\n**Note:**\nI prefer to use the word _node_ instead of _vertex_ in terms of graphs. So don't be irritated.\n\n### PBF-Reader\nExample to show how to read nodes and ways of an OSM PBF file.\nUses [Graphhopper](https://github.com/graphhopper/graphhopper) to read an OSM PBF file.\nSee [PbfReader](/src/main/java/de/sebastianhesse/pbf/reader/PbfReader.java)\n\n### NodeEdgeReader\nExample to show how to simply read nodes and ways into a graph of nodes and edges.\nUses [Graphhopper](https://github.com/graphhopper/graphhopper) to read an OSM PBF file.\nSee [NodeEdgeReader](/src/main/java/de/sebastianhesse/pbf/reader/SimpleNodeEdgeReader.java)\n\n### OsmMapViewer\nExample to show how to connect OSM data with a Swing application and also be able to route between two points.\nUses [JMapViewer](http://wiki.openstreetmap.org/wiki/JMapViewer) to start a Swing application and show a map.\nSee [OsmMapViewer](/src/main/java/de/sebastianhesse/pbf/viewer/OsmMapViewer.java)\n\n### Dropwizard Server\nA [Dropwizard](http://www.dropwizard.io/) application setting up a routing API accessible via REST.\nSee [this package](/src/main/java/de/sebastianhesse/pbf/dropwizard)\n\nIn order to start the server, just hand over a configuration file and an OSM file.\nThe *.yml and *.osm.pbf file must be somewhere on the local system.\nTake a look at the [example *.yml file](/src/main/resources/dropwizard.yml).\n```\n$ mvn clean package\n$ java -jar target/osm-routing.jar server config.yml osm_data.osn.pbf\n```\n\nIf you're using a huge OSM file, you should increase the heap size for the JVM, e.g. ```-Xmx10g``` for 10 GB.\n\nA web frontend will be served from:\n```\nhttp://localhost:8080/index.html\n```\n\n#### REST API\n```\n### Get a path between two points (lat1,lon1) and (lat2,lon2) ###\nvehicle: car, pedestrian\nmode: fastest, shortest \nGET /api/route?lat1=...\u0026lon1=...\u0026lat2=...\u0026lon2=...\u0026vehicle=car\u0026mode=fastest\n\n\n### Get certain POIs around a given position ###\npid: if known, the id of the position/node, otherwise just -1\nmaxDistance: maximum distance to search for gas stations around the position\ntypeKey: key of a Nominatim category, e.g. Amenity\ntypeValue: value of a Nominatim category, e.g. Fuel\nGET /api/pois?lat=...\u0026lon=...\u0026pid=...\u0026maxDistance=20\u0026typeKey=...\u0026typeValue=...\n\n\n### Request all available POI types ###\nOPTIONS /api/pois\n\n\n### Get last updated ways where TMC traffic events have fired for certain hour ###\nGET /api/traffic\n\n\n### Update the routing graph with traffic data for a certain hour ###\nPUT /api/traffic/{hour}\n\n\n### Remove all traffic data from the routing graph ###\nDELETE /api/traffic\n\n\n### Get meta information about the OSM backend ###\nGET /api/meta\n```\n\n#### TMC Support\nOptionally you can start the server by providing some TMC data. For this you need the a Location Code List\n(e.g. for Germany, you can request one here:\nhttps://www.bast.de/DE/Verkehrstechnik/Fachthemen/v2-LCL/location-code-list_node.html) and an event list\n(most likely delivered together with the Location Code List). You also need some TMC data files. Then you can\n start the server with the following arguments:\n \n```\n$ java -jar target/osm-routing.jar server config.yml osm_data.osm.pbf lcl.csv event_list.csv /path/to/tmc/directory\n```\n\n## Development\n1. Check out the repository: ``git clone https://github.com/seeebiii/osm-routing-examples``\n2. Run ```main``` method from ```DropwizardApplication.java``` with the arguments: ``server /path/to/config.yml /path/to/osm/file``\n3. Run [Gulp](http://gulpjs.com/): ``gulp watch``\n4. Start coding!\n\n\n## License\nMIT License\n\nCopyright (c) 2017 [Sebastian Hesse](https://www.sebastianhesse.de/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseeebiii%2Fosm-routing-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseeebiii%2Fosm-routing-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseeebiii%2Fosm-routing-examples/lists"}