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:
url:
http://my-domain/ors/v2/directions/driving-car/json?
Headers:
{
"headers": {
"User-Agent": "ORSClientPython.v2.2.3",
"Content-type": "application/json",
"Authorization": null
},
"timeout": 60,
"json": {
"coordinates": [
[
4.451162,
51.926484
],
[
4.301373,
52.049112
],
[
4.528832,
52.06009
],
[
4.322566,
52.057557
],
[
4.256713,
52.071065
],
[
4.223623,
52.024614
],
[
4.451162,
51.926484
]
]
}
}
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'
services:
ors-app:
container_name: ors-app
ports:
- 8080:8080
image: openrouteservice/openrouteservice:v6.1.0
build:
context: ../
args:
APP_CONFIG: ./openrouteservice/docker/conf/app.config.sample
OSM_FILE: ./osm_data/netherlands-latest.osm.pbf
volumes:
- ./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
environment:
- 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$
Hallo,
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.
nils
June 11, 2020, 6:10pm
3
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?!
nils
June 11, 2020, 6:12pm
4
There IS a tiny bug(ish):
opened 11:33AM - 05 Jun 20 UTC
closed 09:54AM - 16 Jun 20 UTC
optimization
awaiting release
It's very annoying: whenever a new container is created (e.g. when just changing… some env var in `docker-compose.yml`) the new container reads the default `app.config` provided by the image. Regardless if the user actually has a valid config in `./ors-conf`.
Not hard to remedy:
The problem is that `mvn package` is run in the image itself, which packages the default `app.config` into the WAR file. So currently there's no way to access the `app.config` Tomcat will use since it's inside the WAR.
The lines
```
mvn -q -f /ors-core/openrouteservice/pom.xml package -DskipTests && \
cp -f /ors-core/openrouteservice/target/*.war /usr/local/tomcat/webapps/ors.war && \
```
need to be in `docker-entrypoint.sh`, not in the `Dockerfile`, with some logic so we don't package needlessly if nothing changed.
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.
nils
June 11, 2020, 7:18pm
6
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!
nils
June 12, 2020, 11:24am
8
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!
nils
June 14, 2020, 8:33am
9
@LittleBoxOfChicken @SimonDahrs
If you could assist a little by trying if this PR resolves your issues, that’d be appreciated:
GIScience:master
← GIScience:742-fix-docker
opened 09:37PM - 13 Jun 20 UTC
### Pull Request Checklist
- [x] 1. I have [**rebased**](https://github.com/G… IScience/openrouteservice/blob/master/CONTRIBUTE.md#pull-request-guidelines) the latest version of the master branch into my feature branch and all conflicts have been resolved.
- [x] 2. I have added information about the change/addition to functionality to the CHANGELOG.md file under the [Unreleased] heading.
- [ ] 3. I have documented my code using JDocs tags.
- [ ] 4. I have removed unnecessary commented out code, imports and System.out.println statements.
- [ ] 5. I have written JUnit tests for any new methods/classes and ensured that they pass.
- [ ] 6. I have created API tests for any new functionality exposed to the API.
- [ ] 7. If changes/additions are made to the app.config file, I have added these to the app.config wiki page on github along with a short description of what it is for, and documented this in the Pull Request (below).
- [ ] 8. I have built graphs with my code of the Heidelberg.osm.gz file and run the api-tests with all test passing
- [x] 9. I have referenced the Issue Number in the Pull Request (if the changes were from an issue).
- [ ] 10. For new features or changes involving building of graphs, I have tested on a larger dataset (at least Germany) and the graphs build without problems (i.e. no out-of-memory errors).
- [ ] 11. For new features or changes involving the graphbuilding process (i.e. changing encoders, updating the importer etc.), I have generated longer distance routes for the affected profiles with different options (avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end points generated from the current live ORS. If there are differences then the reasoning for these **MUST** be documented in the pull request.
- [x] 12. I have written in the Pull Request information about the changes made including their intended usage and why the change was needed.
Fixes #742 .
### Information about the changes
- Key functionality added:
- default `app.config.sample` from `./openrouteservice/src/main/resources/app.config.sample` is used to build the image
- be aware the image changes the `app.config` to
- only build `car` instead of all profiles
- `init_threads: 1` since > 1 can cause issues
- changes all paths to docker image paths
- uses the default `heidelberg.osm.gz`
- Reason for change: Before we had two `app.config`, one for the native Java app, one for docker. This PR removes that maintenance burden.
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-arg
s 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?
adam
June 17, 2020, 6:28am
12
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
nils
June 17, 2020, 7:11am
13
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
EXPOSE 8080
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]