Source:
Clone GraphHopper's GitHub repository:
git clone git://github.com/graphhopper/graphhopper.git
Change GraphHopper repository branch to the latest stable version:
cd graphhopper
git checkout 0.8
Get .pbf files of OpenStreetMap data for the desired region from Geofabrik:
wget http://download.geofabrik.de/europe/spain-latest.osm.pbf
Allow Java to use enough memory to integrate the OpenStreetMap in GraphHopper:
export JAVA_OPTS="-Xmx3072M"
Copy config-example.properties
file, rename it to config.properties
, and change the line prepare.chWeighting=fastest
for prepare.chWeighting=fastest, shortest
.
The first time graphhopper will import the OpenStreetMap data (may take a while):
./graphhopper.sh web spain-latest.osm.pbf
When the task is complete, you will have GraphHopper running locally in http://localhost:8989
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.