Specs needed for running openrouteservice locally

I recently found this service and API and think it’s totally awesome. Such a brilliant service. I want to do some quite dense network analysis using routing (and animating the resulting geojson) which would greatly exceed the 2,000 API calls daily limit so am considering a local setup. I have seen there are instructions here although at first glance they look beyond my level of technical competence. https://github.com/GIScience/openrouteservice#installation
Nevertheless I have two questions:

  1. What kind of specs are required (principally RAM and disk space) to run this service locally, using only Scotland as the input file? I have an OKish windows 64 desktop, i7 6700, 16GB ram

  2. How hard is it to install and set the thing up? I’ve never heard of docker or Maven, so there’s probably no point attempting something that’s well beyond my comfort zone. On the other hand I’m fairly good with computers so this could be a chance to learn. I guess it’s a bit like doing mechanics on your car: I could change a battery but I’d never embark on changing a head gasket, even though there’s a book with clear instructions.

For interest, this is the kind of thing I’ll be doing, but on a much bigger scale https://twitter.com/JohnTdata/status/1230860015864598528

Thanks.

  1. that’ll cover entire Europe, no worries :slight_smile:
  2. learn docker, you’ll love it. Your future self will be very thankful for whatever service you’ll set up in the next years
2 Likes

OK Thanks Nils, I will give it a go!

On this page (https://hub.docker.com/r/openrouteservice/openrouteservice) there is a link to the docker installation guide which returns a 404:

https://hub.docker.com/r/openrouteservice/docker/README.md

I thought I would point that out. Otherwise I have found instructions here

https://hub.docker.com/r/openrouteservice/openrouteservice
https://hub.docker.com/r/giscience/openrouteservice

If there are any key sources of instructions please let me know. Thanks

Provided you have docker installed.

  1. docker pull openrouteservice/openrouteservice
  2. docker run -p <desired host port>:8080 openrouteservice/openrouteservice

Test service by going to a browser and hit <host machine IP>:<desired host port>/ors/health (e.g., http://localhost:8080/ors/health).

As per official guide, you should get a status = ready if all goes well.

Thanks @leungi. It’s actually a bit more complicated than that, and the help information is patchy and difficult to follow if you’re not a programmer. But here are the steps I took to get this working on Windows 10 Pro, hopefully they might be useful to anyone else hitting their head against a brick wall.

  1. Install Docker for Windows https://hub.docker.com/editions/community/docker-ce-desktop-windows/

  2. Enable CPU virtualization in BIOS, this will differ by machine https://www.bleepingcomputer.com/tutorials/how-to-enable-cpu-virtualization-in-your-computer-bios/ If you don’t have Windows 10 Pro edition I’m not sure if you can complete this step, but this guy managed it somehow so check out his post Couldn't Process File data/osm_file.pbf during Docker Install Process

  3. In Docker Desktop (you may need to access its settings window from the icon in the system tray: right click -> Settings) you need to go into Resources -> File Sharing and add the folder where you want your files to live. For me it’s C:\Temp\Docker2 because I messed up the first time.

  4. Now you can go to the windows command prompt (Windows key -> cmd) and run this command which does a bunch of stuff behind the scenes which I don’t really understand:
    docker pull openrouteservice/openrouteservice

  5. Now it’s time to get some openstreetmap data as a pbf file. I used just Scotland [.osm.pbf] which I downloaded from here http://download.geofabrik.de/europe/great-britain.html I saved that file to here C:\Temp\scotland-latest.osm.pbf

  6. Now we need to run docker, there are instructions here but they didn’t make a lot of sense to me as a Windows user https://github.com/GIScience/openrouteservice/blob/master/docker/README.md

Evetually I figured out that I had to paste a command into the windows command line, and this is the one that worked:

docker run -dt --name ors-app -p 8080:8080 -v C:/Temp/Docker2/graphs:/ors-core/data/graphs -v C:/Temp/Docker2/elevation_cache:/ors-core/data/elevation_cache -v C:/Temp/Docker2/conf:/ors-conf -v C:/Temp/scotland-latest.osm.pbf:/ors-core/data/osm_file.pbf -e "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g" -e "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost" openrouteservice/openrouteservice:latest

You will obviously need to update the folder paths depending on your file structure, but you ought to be able to do that easily. Just use notepad to find/replace any instance of C:/Temp/Docker2…

  1. THIS IS REALLY IMPORTANT - If the command above worked, the command prompt will return a long string like this 8a405afe2d915f5376ce2e12afd1bc67bd56edc499742701cb656360daff846f

That’s a good sign, and although there’s no progress or confirmation, stuff is happening behind the scenes. Open Task Manager and check that Vmmem is using CPU and doing stuff. I think that docker is builing graphs (edges and nodes of your road network) but it does that silently. So don’t give up at this point or repeat the command. It’s incredibly unclear what’s going on at this stage but I guess once you know you know.

  1. Now you can test it by opening a url like this in your browser http://localhost:8080/ors. The instructions talk about installing tomcat but I didn’t need to do this. Note that unless you have the Scotland data installed, this won’t work http://localhost:8080/ors/v2/directions/driving-car?start=-3.167209,55.974753&end=-3.398842,56.081019

  2. The settings all live in a file called app.config in a directory called conf: C:\Temp\Docker2\conf\app.config
    You can open this file in a text editor to change it. For example I increased the max distance from 100km to 1000km. However these settings won’t make any difference until you restart the docker container

  3. To restart the container you first need an id for your container. Back in windows command prompt type
    docker container ls –aq
    Now use the output to amend this command:
    docker container restart 8a405afe2d91

Good luck! It’s an awesome tool, and it’s free so you can’t really complain, and the support here seems to be excellent. But the help and instructions for newbie windows users like me are poor. These links might be useful as there seems to be documentation in loads of different places:



https://hub.docker.com/r/openrouteservice/openrouteservice

https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/post

You may also see links to this page which doesn’t exist https://hub.docker.com/r/openrouteservice/docker/README.md

3 Likes

Thanks @johntdata for that info, it looks really useful :slight_smile:

The main problem we have here is that no one from the openrouteservice developer team actually uses Windows - we are all Linux and Mac users so it’s a bit trickier to document getting the setup running with Docker in a Windows environment. But that’s one of the great benefits of having a forum like this - that people like yourself can share their knowledge and experience :smiley:

Amazingly detailed; the bit to link the individual volumes to the container is key :+1:

The community will benefit a lot from your knowledge share :pray: