https://github.com/hahaslav/osm-bfs
A router, based on the BFS algorithm, for OpenStreetMap data
https://github.com/hahaslav/osm-bfs
bfs bfs-algorithm openstreetmap osm
Last synced: about 1 month ago
JSON representation
A router, based on the BFS algorithm, for OpenStreetMap data
- Host: GitHub
- URL: https://github.com/hahaslav/osm-bfs
- Owner: hahaslav
- License: mit
- Created: 2020-07-22T15:42:15.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-07T08:55:07.000Z (over 2 years ago)
- Last Synced: 2023-09-02T14:44:10.497Z (almost 2 years ago)
- Topics: bfs, bfs-algorithm, openstreetmap, osm
- Language: C++
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A router, based on the BFS algorithm, for OpenStreetMap data
###### English|[Українська](https://github.com/hahaslav/osm-bfs/blob/master/README_UK.md)
### ***Caution! This app is not meant to be used as a serious road router.***
## Building
The source code can be found in *[main.cpp](https://github.com/hahaslav/osm-bfs/blob/master/main.cpp)*. The [released app](https://github.com/hahaslav/osm-bfs/releases/latest) was built with GNU GCC 5.1.0 with parameters `-std=c++11 -Wall -O2`.
## Implementation
The app uses the [Breadth-first search algorithm](https://en.wikipedia.org/wiki/Breadth-first_search) to find the path between two nodes. This path will have the least amount of nodes.

## Usage
1. Download any *.osm* file with an area where you want to find a way. Rename this file to *input.osm* and put it in the same folder where the app executable is located.
2. Run the app.
3. Enter the id of the start and the finish nodes of the way.
4. Has the app output "*Program successfully executed!*"? If yes, congratulations!
## Reading the output data
### Method **I**:
Open a generated *map.html* in any web browser. It has a map with the way marked on it.
### Method **II**:
1. Start opening [JOSM](https://josm.openstreetmap.de).
2. At the same time, open a generated *JOSM.txt*.
3. Copy its content into the clipboard.
4. In JOSM, open *File>Download object...* (*Ctrl+Shift+O*):
* In the list *Object type* choose *node*.
* Check that the field *Object ID* has the copied text.
* Unflag *Download referrers (parent relations)*.
* Flag *Separate Layer*.
5. Done!
## Also
The app was tested in 2020 only on Windows 10. It was compatible with exported data from [OpenStreetMap](https://www.openstreetmap.org) and [overpass turbo](https://overpass-turbo.eu/). If the data has too many nodes, the memory for the algorithm may be overflowed (I guess so).