Let's assume that you have arrived in Zurich because you have to do an intership on Google (a hypothetical case, of course).
You have been eating in the center of Zurich, but you still don't know how to get to Google. Like any other person, you could open Google maps and search for it. However, you know a more interesting way to do it:
You declare that Google is at the coordinates (20, 35) of your map and you go from (200, 60). And, simply using a map that you downloaded from OpenStreetMap, you get to Google thanks to this A* search algorithm:
I encourage you to use Ubuntu and it's crucial to follow the next steps as install the IO2D package can throw many errors!
If you have a MacBook (ARM or x86), I recommend you to use an Ubuntu Virtual Machine (for example, by using Parallels). I'm using an M1 Macbook Air with an Ubuntu VM and it works without any issue.
Don't forget to use the flag --recurse-submodules
. It'll allow you to install the necessary modules (you can view them in the file .gitmodules).
Using HTTPS:
git clone https://github.com/aaronespasa/a-star-openstreetmap.git --recurse-submodules
Or using SSH:
git clone [email protected]:aaronespasa/a-star-openstreetmap.git --recurse-submodules
And get into it: cd a-star-openstreetmap
.
Install all the necessary dependencies:
>>> sudo apt update
>>> sudo apt install build-essential
>>> sudo apt install cmake
>>> sudo apt install libcairo2-dev
>>> sudo apt install libgraphicsmagick1-dev
>>> sudo apt install libpng-dev
All the modules are install inside the folder thirdparty/
, so go to that directory cd thirdparty/
.
Clone the IO2D package:
>>> git clone --recurse-submodules https://github.com/cpp-io2d/P0267_RefImpl
>>> cd P0267_RefImpl
Create a folder called Debug/
and install the IO2D package there using CMake:
>>> mkdir Debug && cd Debug
>>> cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
>>> cmake --build .
>>> sudo make install
Go to the main folder a-star-openstreetmap/
(be careful not to be in the folder thirdparty/
).
Then, create the build
directory and run cmake
and make
:
>>> mkdir build && cd build
>>> cmake ..
>>> make
You're all set! 🎉
Once you're in the build/
directory, execute the following command:
>>> ./OSM_A_star_search
And to specify your own map file:
>>> ./OSM_A_star_search -f ../<your_osm_file.osm>
=======
All the modules are install inside the folder `thirdparty/`, so go to that directory `cd thirdparty/`.
Clone the IO2D package:
```bash
>>> git clone --recurse-submodules https://github.com/cpp-io2d/P0267_RefImpl
>>> cd P0267_RefImpl
Create a folder called Debug/
and install the IO2D package there using CMake:
>>> mkdir Debug && cd Debug
>>> cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
>>> cmake --build .
>>> sudo make install
Go to the main folder a-star-openstreetmap/
(be careful not to be in the folder thirdparty/
).
Then, create the build
directory and run cmake
and make
:
>>> mkdir build && cd build
>>> cmake ..
>>> make
You're all set! 🎉
Once you're in the build/
directory, execute the following command:
>>> ./OSM_A_star_search
And to specify your own map file:
>>> ./OSM_A_star_search -f ../<your_osm_file.osm>
The base files were provided by Udacity but all the A-Star implementation were made by my own.