Own hosted openrouteservice instance not working

I have my own hosted instance of openrouteservice using their Docker image (https://github.com/GIScience/openrouteservice). I downloaded the .pbf file of the Netherlands from https://download.geofabrik.de/europe/netherlands.html, and I set to use this file in the docker-compose file.

When I run a simple query on this instance, like:

  "headers": {
    "User-Agent": "ORSClientPython.v2.2.3",
    "Content-type": "application/json",
    "Authorization": null
  "timeout": 60,
  "json": {
    "coordinates": [

I get the response Could not find point 0: 4.4511620 51.9264840 within a radius of 350.0 meters. While, when I run this exact same query, I do get a succesful response.

Does anyone know what is going wrong here?

Here’s my docker-compose.yml:

version: '3'
    container_name: ors-app
      - 8080:8080
    image: openrouteservice/openrouteservice:v6.1.0
      context: ../
        APP_CONFIG: ./openrouteservice/docker/conf/app.config.sample
        OSM_FILE: ./osm_data/netherlands-latest.osm.pbf
      - ./graphs:/ors-core/data/graphs
      - ./elevation_cache:/ors-core/data/elevation_cache
      - ./logs/ors:/var/log/ors
      - ./logs/tomcat:/usr/local/tomcat/logs
      - ./conf:/ors-conf
      - ./osm_data/netherlands-latest.osm.pbf:/ors-core/data/osm_file.pbf
      - BUILD_GRAPHS=False  # Forces the container to rebuild the graphs, e.g. when PBF is changed in app.config
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThread$
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=fals$


I’m also from the Netherlands and I’m also trying to get the service working with that same file. It seems to me that the .pbf file of the entire Netherlands is broken right now. Building routes of each provice separately works fine.

Also you should change BUILD_GRAPHS=False to BUILD_GRAPHS=True otherwise it will not try to recalculate the graphs. (which determine your routes)

Also if, after changing the environment variable, you have any luck with the netherlands-latest.osm.pbf file, let me know. :slight_smile:

You sure about that? Did you try all provinces separately, they build, but entire country doesn’t?

What’s the error? I’d guess on a out-of-memory?!

There IS a tiny bug(ish):

When the container starts the first time, it most likely will build Heidelberg. Try coordinates from Heidelberg, my guess is they work. If you just restart the container it should work. But to be sure do BUILD_GRAPHS=True.

1 Like

Thanks, this was exactly the issue I had!
Apparently the graphs were built using the Heidelberg dataset so it couldn’t find my Dutch coordinates.
I deleted the graphs folder, which is equivalent to setting BUILD_GRAPHS=True to build the correct graphs.

Yeah damn. Will fix that tmrw or the weekend. Almost everyone, myself included, gets confused by that.

I fixed it as well. My issue was that it wasn’t using my updated config file and I had to run it with init_thread: 1 instead of 2. I didn’t explicitly get an out of memory exception though… odd.

Glad we all got it working though! :slight_smile:

Ooh yes that is a good point. Almost forgot that it can be an issue. You must’ve tested a lot to get to that point. Really sorry about that!

@LittleBoxOfChicken @SimonDahrs

If you could assist a little by trying if this PR resolves your issues, that’d be appreciated:

The image is not available on dockerhub yet, but you can pull the associated branch and do a manual build:

docker build -t openrouteservice/openrouteservice:test_docker --build-arg OSM_FILE=./your_osm.pbf APP_CONFIG=./your.app.config .

Or even omit the build-args and specify those as environment variables in the docker-compose.yml to launch a container.

I was able to get this version to run with the fix. Unfortunately, I’m unable to update the query limits as I had in the app.config. How should I increase the max time for isochrones in the Dockerfile?

You should be able to change it as before, but possibly it is using a cached image so I would try the build with the --no-cache parameter aswell

It’s a mapped path, there’s no cache. Whatever you change in there, will be immediately reflected inside the container and a restart of the container should load the new settings.

Interesting. I tried to do this numerous times. Searched for anything with 3600 (isochrone time limit) and changed every app.config that I could find, just in case it was still somehow pulling from a different location. Well, nothing worked, so I force fed it in the Dockerfile, which worked for everything except the profile-car… Below is the Dockerfile. The new numbers are more or less arbitrary, just trying to ensure I can properly increase them before determining my needed limits. Of course, if I ever change these settings, I have to rebuild, not just restart the container.

FROM openjdk:8-jdk

ENV MAVEN_OPTS="-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
ENV MAVEN_CLI_OPTS="--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

ARG APP_CONFIG=./openrouteservice/src/main/resources/app.config
ARG OSM_FILE=./openrouteservice/src/main/files/north-america-latest.osm.pbf

WORKDIR /ors-core

COPY openrouteservice /ors-core/openrouteservice
COPY $OSM_FILE /ors-core/data/osm_file.pbf
COPY $APP_CONFIG /ors-core/openrouteservice/src/main/resources/app.config

# Install tomcat
RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz -O /tmp/tomcat.tar.gz && \
    cd /tmp && \
    tar xvfz tomcat.tar.gz && \
    mkdir /usr/local/tomcat && \
    cp -R /tmp/apache-tomcat-8.0.32/* /usr/local/tomcat/ && \
    # Install dependencies and locales
    apt-get update -qq && apt-get install -qq -y locales nano maven moreutils jq && \
    locale-gen en_US.UTF-8 && \
    # Rename to app.config
    cp /ors-core/openrouteservice/src/main/resources/app.config.sample /ors-core/openrouteservice/src/main/resources/app.config && \
    # Replace paths in app.config to match docker setup
    jq '.ors.services.routing.sources[0] = "data/osm_file.pbf"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.profiles.default_params.elevation_cache_path = "data/elevation_cache"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.profiles.default_params.graphs_root_path = "data/graphs"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
#    jq '.ors.services.isochrones.maximum_range_time[1].value = 3600000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    #jq '.ors.services.isochrones.enabled = "false"' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    # init_threads = 1, > 1 been reported some issues
    jq '.ors.services.routing.init_threads = 1' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    # Increased Matrix Limits
    jq '.ors.services.matrix.maximum_search_radius = 5000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    # Increased Isochrones
    jq '.ors.services.isochrones.maximum_range_time[0] = { "profiles": "any", "value": 18000000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_range_time[1] = { "profiles": "driving-car, driving-hgv", "value": 3600000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_range_distance[0] = { "profiles": "any", "value": 50000000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_range_distance[0] = { "profiles": "driving-car, driving-hgv", "value": 100000000 }' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_intervals = 10000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.isochrones.maximum_locations = 2000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \

    # Increased Routing
    jq '.ors.services.routing.default_params.maximum_distance = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_dynamic_weights = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_avoid_areas = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_waypoints = 5000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_snapping_radius = 40000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_avoid_polygon_area = 20000000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_avoid_polygon_extent = 20000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_alternative_routes = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
    jq '.ors.services.routing.default_params.maximum_distance_round_trip_routes = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \
#    jq '.ors.services.profile-car.parameters.maximum_distance = 100000000' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config && \

    # Delete all profiles but car
    jq 'del(.ors.services.routing.profiles.active[1,2,3,4,5,6,7,8])' /ors-core/openrouteservice/src/main/resources/app.config |sponge /ors-core/openrouteservice/src/main/resources/app.config

COPY ./docker-entrypoint.sh /docker-entrypoint.sh

# Start the container
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]