Ubuntu 16.04
https://www.microsoft.com/net/core#linuxubuntu
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.0.0
https://github.com/itinero/idp
git clone https://github.com/itinero/idp.git
cd ./idp
sh build.sh
sh publish.sh
wget http://download.geofabrik.de/europe/belgium-latest.osm.pbf
./src/IDP/bin/release/netcoreapp2.0/ubuntu.16.04-x64/IDP \
--read-pbf belgium-latest.osm.pbf --pr \
--create-routerdb vehicles=pedestrian \
--contract pedestrian \
--write-routerdb belgium.p.routerdb
or
./src/IDP/bin/release/netcoreapp2.0/ubuntu.16.04-x64/IDP \
--read-pbf belgium-latest.osm.pbf --pr \
--create-routerdb vehicles=pedestrian \
--write-routerdb belgium.p.routerdb
./src/IDP/bin/release/netcoreapp2.0/ubuntu.16.04-x64/IDP \
--read-routerdb belgium.p.routerdb --pr \
--contract pedestrian \
--write-routerdb belgium.p.cf.routerdb
If you need shortest
profile, just add --contract pedestrian.shortest
!
./src/IDP/bin/release/netcoreapp2.0/ubuntu.16.04-x64/IDP \
--read-pbf ../belgium-latest.osm.pbf --pr \
--create-routerdb vehicles=car,pedestrian \
--contract car --contract pedestrian
--write-routerdb belgium.cp.cf.routerdb
.cp
is forcar
+pedestrian
profiles
.cf
is forfastest
contraction
If you want to use a custom profile, replace car
or pedestrian
default profile by the path to the .lua
file :
./src/IDP/bin/release/netcoreapp2.0/ubuntu.16.04-x64/IDP \
--read-pbf ../belgium-latest.osm.pbf --pr \
--create-routerdb vehicles=car,./profiles/osm/pedestrian.lua \
--contract car --contract pedestrian
--write-routerdb belgium.cp.cf.routerdb
git clone https://github.com/itinero/routing-api.git
cd ./routing-api
sh build.sh
Copy the .routerdb
file(s) must be in the ./routing-api/src/Itinero.API/data
directory !
sudo apt-get install supervisor
Edit supervisord.conf
sudo vim /etc/supervisor/supervisord.conf
Change chmod from 700 to 766.
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0766 ; socket file mode (default 0700)
Create configuration file for Routing API
sudo vim /etc/supervisor/conf.d/routing-api.conf
Add following content :
[group:routing]
programs=routing
[program:routing]
directory=/home/ubuntu/routing-api/src/Itinero.API
command=/usr/bin/dotnet ./bin/Debug/netcoreapp2.0/Itinero.API.dll
autostart=true
autorestart=true
stderr_logfile=/var/log/routing.err.log
stdout_logfile=/var/log/routing.out.log
user=ubuntu
stopsignal=INT
stopasgroup=true
Restart supervisor
sudo service supervisor restart
Start Routing API Background Service
supervisorctl start routing:
sudo apt install apache2
Enable mod_proxy_http
sudo a2enmod proxy_http
Edit 000-default.conf
sudo vim /etc/apache2/sites-available/000-default.conf
Add following content :
ProxyPass "/" "http://localhost:5000/"
ProxyPassReverse "/" "http://localhost:5000/"
Restart apache2
sudo service apache2 restart
Everything should now work ; you can use the API by connecting to http://<yourIPAddress>/
!