{"id":13417966,"url":"https://github.com/ibaaj/dijkstra-cartography","last_synced_at":"2025-10-04T18:31:44.462Z","repository":{"id":42864601,"uuid":"56004753","full_name":"ibaaj/dijkstra-cartography","owner":"ibaaj","description":"Using Dijkstra's algorithm (\"finding the shortest paths between nodes in a graph\") to draw maps :earth_africa:.","archived":true,"fork":false,"pushed_at":"2016-10-27T21:56:18.000Z","size":49827,"stargazers_count":1157,"open_issues_count":0,"forks_count":75,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-09-30T05:01:20.972Z","etag":null,"topics":["algorithm","cartography","dijkstra","dijkstra-cartography","drawing","openstreetmap","paris"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ibaaj.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-11T20:19:57.000Z","updated_at":"2024-09-23T01:44:50.000Z","dependencies_parsed_at":"2022-07-09T07:31:23.849Z","dependency_job_id":null,"html_url":"https://github.com/ibaaj/dijkstra-cartography","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/ibaaj%2Fdijkstra-cartography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibaaj%2Fdijkstra-cartography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibaaj%2Fdijkstra-cartography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibaaj%2Fdijkstra-cartography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibaaj","download_url":"https://codeload.github.com/ibaaj/dijkstra-cartography/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235289290,"owners_count":18965916,"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":["algorithm","cartography","dijkstra","dijkstra-cartography","drawing","openstreetmap","paris"],"created_at":"2024-07-30T22:00:56.369Z","updated_at":"2025-10-04T18:31:34.533Z","avatar_url":"https://github.com/ibaaj.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","C++"],"sub_categories":[],"readme":"# Dijkstra Cartography\n\n\n- All roads lead to my home (at least in Paris) [[HD 14016x9599 / 7.3MB](./results/HD/paris.png)]\n ![./results/SD/paris.png](./results/SD/paris.png)\n- The Amazon river / Rio Amazonas with all its tributaries [[HD 11962x7625 / 3MB](./results/HD/amazon.png)]\n![./results/SD/amazon.png](./results/SD/amazon.png)\n- Eastern European Railway (from Paris) [[HD 29255x9624 / 10.8MB](./results/HD/railway.png)]\n![./results/SD/railway.png](./results/SD/railway.png)\n- World Flights (from Paris) [[HD 17900x6600 / 17.72MB](./results/HD/flights.png)]\n![./results/SD/flights.png](./results/SD/flights.png)\n\n## Introduction\n\nI was fascinated by the project [\"Roads to Rome\"](http://roadstorome.moovellab.com/) by Moovellab but sad that it isn't opensource. Helped by [this project](https://github.com/Tristramg/roads-from-nd) (thanks @tristramg ) I started to build my own map.\n\nI did not have any GIS background but it was very interesting to discover what we can do with. The code isn't very good (I'm not a *C++ guru*).\n\nThe project is named \"*Dijkstra Cartography*\" but sometimes [BFS algorithm](https://en.wikipedia.org/wiki/Breadth-first_search) is better (if all the edges have the same weight).\n\nThis code can be useful for cartographer, as I found a lot of errors for the river Amazon ([see here](./results/errors.png)) or.. to have your own poster 😉.\n\n## Extract\n\nYou may not want to use the [planet.osm](http://wiki.openstreetmap.org/wiki/Planet.osm) file (644GB - all the openstreetmap data in one file).\nChoose the right file [here](https://download.geofabrik.de) and extract what you really need with openstreetmap's tools : osmconvert, osmfilter, osmosis, osmium...\n\nOne interesting way is that you can extract all the data within a polygon with osmconvert, and [here are some cities polygons](https://github.com/JamesChevalier/cities).\n\n## Routing\n\n| Map        | Routing system used                                      |\n| -----------|----------------------------------------------------------|\n| Paris      | [Graphhopper](https://github.com/graphhopper/graphhopper) - \"Dijkstrabi\" |\n| Amazon     | Dijkstra's algorithm                                     |\n| Railway    | [OSRM](https://github.com/Project-OSRM/osrm-backend)     |\n| Flights    | Dijkstra's algorithm  \n\nThe first thing to do is to gather the statistics of usage of all paths :\nfor each location, execute the routing algorithm you chose to your root location (your home for example).\nMerge all and sort the data by the most used path.\n\n\n\n## Projections\n\n| Map        | Projection                                    |\n| -----------|-----------------------------------------------|\n| Paris      | Lambert 93-I EPSG:27571                       |\n| Amazon     | ESRI:102032 (South America Equidistant Conic) |\n| Railway    | Mercator                                      |\n| Flights    | WSG84                                         |\n\nYou can follow [this guide](http://www.georeference.org/doc/guide_to_selecting_map_projections.htm), search [SpatialReference](http://spatialreference.org/ref/) or [ESPG.io](http://epsg.io/).\n\n\n## Drawing\nConsidering the data is sorted and well projected.\n\nThe width and height of the image are defined like this :\n\n```\nwidth = (maxX-minX)/scale;\nheight = (maxY-minY)/scale;\n```\n\nTo draw these paths, I used this function (plotted using R) :\n![./results/function.jpg](./results/function.jpg)\n\nas it gives me a percent (between [0;1] here) of how the line width must be  important. Also I can accentuate the decreasing by modifying parameters inside *exp()*.\n\nI used cairo and I was really suprised that I can understand these map without using any shapefile.\n\n\n\n## Details for each map\n\n- [Paris](./paris/)\n- [Amazon](./amazon/)\n- [Railway](./railway/)\n- [Flights](./flights/)\n\n## Bonus\n\n![./results/paris.gif](./results/paris.gif)\n\n## License\n\n[See here](./license.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibaaj%2Fdijkstra-cartography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibaaj%2Fdijkstra-cartography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibaaj%2Fdijkstra-cartography/lists"}