Getting started with ORS via docker and localhost

Hi folks,

I installed ORS via docker on a Windows 64bit machine and added our data.

localhost:8080/ors/health shows “ready”
localhost:8080/ors/status shows all services and profiles.

I have three questions:

  1. The github README suggests issuing requests via localhost:8080/name_of_war_archive/routes but I don’t know what “name_of_war_archive” refers to. Is it the name of the JAVA app? A directory?

  2. Where is the REST API format documented? Are there example valid requests?

  3. If I want to issue thousands of requests from Python to my own ORS installation and store the results, should I use https://github.com/GIScience/openrouteservice-py ?

Thank you,
-david

Hi,
congrats:)

The name of the war archive is generally ors, so try that. The docu is a little outdated, see the awesome interactive API docu here:

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

Also, use v2 API, i.e. /ors/v2/directions/....

  1. yes, easiest.

Thanks Nils! Do I need to setup an API key for my own machine (localhost) or will it accept local queries automatically?

No, API keys for local installations… Welcome to true FOSS :slight_smile:

Hi Nils,

I placed the OSM file for all of Asia (asia-latest.osm.pbf) in the docker/data directory and OSR regenerated docker/graph directories and data. However, OSR cannot seem to find any points.

These points are in Chengdu, China:

import openrouteservice
coords = ((104.06318, 30.77571), (104.17279, 30.65768))
client = openrouteservice.Client(base_url='http://localhost:8080/ors')
routes = client.directions(coords)

The code produces this trace:

C:\ProgramData\Anaconda3\envs\geo\python.exe D:/Projects/AUTOlab/DiDi/python_code/ors_requester.py

Traceback (most recent call last):

File “D:/Projects/AUTOlab/DiDi/python_code/ors_requester.py”, line 9, in <module>

routes = client.directions(coords)

File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\client.py”, line 293, in wrapper

result = func(*args, **kwargs)

File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\directions.py”, line 262, in directions

return client.request("/v2/directions/" + profile + '/' + format, {}, post_json=params, dry_run=dry_run)

File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\client.py”, line 204, in request

result = self._get_body(response)

File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\client.py”, line 240, in _get_body

body

openrouteservice.exceptions.ApiError: 404 ({‘error’: {‘code’: 2010, ‘message’: ‘Could not find point 0: 104.0631800 30.7757100 within a radius of 350.0 meters.’}, ‘info’: {‘engine’: {‘version’: ‘6.0.0’, ‘build_date’: ‘2020-03-03T10:42:32Z’}, ‘timestamp’: 1583401532163}})

Process finished with exit code 1

The request looks fine to me, i.e. right coordinate sequence. (lots of people confuse lat/lon)

So, it can only be your data. Are you sure it actually recreated the graphs for Asia? Try some coordinates in Heidelberg (that’s the test dataset you probably tried first). If that’s not the case, then please provide:

  • output of tree . -h where the docker-compose file is, i.e. all files that are relevant for ORS deployment
  • your docker-compose file (or full docker run command)
  • your app.config.sample or the app config you used

Hi Nils,

I’m just getting back to open route service. Tel Aviv University is closed and I’m working from home. I hope you and your family and friends are safe and healthy during this stressful time.

Using coordinates from your pub crawl example, `coords = ((13.43926404, 52.48961046), (13.42040115, 52.49586382)) I still get:

`C:\ProgramData\Anaconda3\envs\geo\python.exe D:/Projects/AUTOlab/DiDi/python_code/ors_requester.py
Traceback (most recent call last):
File “D:/Projects/AUTOlab/DiDi/python_code/ors_requester.py”, line 10, in
routes = client.directions(coords)
File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\client.py”, line 293, in wrapper
result = func(*args, **kwargs)
File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\directions.py”, line 262, in directions
return client.request("/v2/directions/" + profile + ‘/’ + format, {}, post_json=params, dry_run=dry_run)
File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\client.py”, line 204, in request
result = self._get_body(response)
File “C:\ProgramData\Anaconda3\envs\geo\lib\site-packages\openrouteservice\client.py”, line 240, in _get_body
body
openrouteservice.exceptions.ApiError: 404 ({‘error’: {‘code’: 2010, ‘message’: ‘Could not find point 0: 13.4392640 52.4896105 within a radius of 350.0 meters.’}, ‘info’: {‘engine’: {‘version’: ‘6.0.0’, ‘build_date’: ‘2020-03-03T10:42:32Z’}, ‘timestamp’: 1584535331794}})

Process finished with exit code 1`

I can’t seem to upload any files here. I’ll send to the email listed for you on githib.

-david

Well, did you load Berlin data? Thought you’re in Asia?!

Hi Nils.

I received the error initially for data I believed I had loaded for Asia. You suggested to try some coordinates in Heidelberg since that’s the test dataset that came with the system. I think you were concerned that maybe the Asia data didn’t load correctly. I took some coordinates from the polygon in your pub crawl example thinking they would be found in the test data (if those data were still in the system instead of Asia). The coords I used were `coords = ((13.43926404, 52.48961046), (13.42040115, 52.49586382)). I received the same error. Should these coords have been in the test data if it were still loaded?

Below is the diagnostic info you thought might be helpful. I modified the links in the files so the forum would accept the post (only 2 “links” allowed per post). You will see [REMOVED] where I edited the file links.

Folder PATH listing for volume New Volume Volume serial number is 8AC9-B478
D: | PROJECTS | OPENROUTESERVICE | DOCKER

├───conf
├───data
│ └───elevation_cache
├───elevation_cache
├───graphs
│ ├───bike
│ ├───pedestrian-walk
│ ├───vehicles-car
│ └───vehicles-hgv
└───logs
├───ors
└───tomcat


FILE: docker-compose.yml

version: ‘3’
services:
ors-app:
container_name: ors-app
ports:
- 8080:8080
build:
context: …/
args:
APP_CONFIG: ./docker/conf/app.config.sample
OSM_FILE: ./docker/data/asia-latest.osm.pbf
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
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
volumes:
- ./graphs:/ors-core/data/graphs
- ./elevation_cache:/ors-core/data/elevation_cache
- ./logs/ors/:/var/log/ors/
- ./logs/tomcat/:/usr/local/tomcat/logs


FILE: app.config.sample IN docker\config

{
“ors”:{
“info”: {
“base_url”: [REMOVED]
“support_mail”: [REMOVED]
“author_tag”: “openrouteservice”,
“content_licence”: “LGPL 3.0”
},
“services”:{
“matrix”:{
“enabled”:true,
“maximum_locations”:200,
“maximum_visited_nodes”:100000,
“allow_resolve_locations”:true,
“attribution”: [REMOVED]
},
“isochrones”:{
“enabled”:true,
“maximum_range_distance”:[
{
“profiles”:“any”,
“value”:50000
},
{
“profiles”:“driving-car, driving-hgv, cycling-regular, foot-walking”,
“value”:100000
}
],
“maximum_range_time”:[
{
“profiles”:“any”,
“value”:18000
},
{
“profiles”:“driving-car, driving-hgv, cycling-regular, foot-walking”,
“value”:3600
}
],
“maximum_intervals”:10,
“maximum_locations”:2,
“allow_compute_area”:true,
“attribution” [REMOVED]
},
“routing”:{
“enabled”:true,
“mode”:“normal”,
“sources”:[
“data/osm_file.pbf”
],
“init_threads”:1,
“attribution” [REMOVED]
“distance_approximation”:true,
“profiles”:{
“active”:[
“vehicles-car”,
“vehicles-hgv”,
“bike”,
“pedestrian-walk”
],
“default_params”: {
“encoder_flags_size”: 8,
“graphs_root_path”: “data/graphs”,
“elevation_provider”: “multi”,
“elevation_cache_path”: “data/elevation_cache”,
“elevation_clear_cache”: true,
“instructions”: true,
“maximum_distance”: 100000,
“maximum_segment_distance_with_dynamic_weights”: 100000,
“maximum_waypoints”: 50
},
“profile-vehicles-car”:{
“profiles”:“driving-car”,
“parameters”:{
“encoder_options”:“consider_elevation=true|turn_costs=true|block_fords=false|use_acceleration=true”,
“elevation”:true,
“preparation”:{
“min_network_size”:200,
“min_one_way_network_size”:200,
“methods”:{
“ch”:{
“enabled”:true,
“threads”:8,
“weightings”:“fastest”
},
“lm”:{
“enabled”:true,
“threads”:8,
“weightings”:“fastest,shortest”,
“landmarks”:24
}
}
},
“execution”:{
“methods”:{
“astar”:{
“approximation”:“BeelineSimplification”,
“epsilon”:1
},
“ch”:{
“disabling_allowed”:true
},
“lm”:{
“disabling_allowed”:true,
“active_landmarks”:6
}
}
},
“ext_storages”:{
“WayCategory”:{

                    },
                    "WaySurfaceType":{

                    },
                    "Tollways":{

                    }
                 }
              }
           },
           "profile-vehicles-hgv":{
              "profiles":"driving-hgv",
              "parameters":{
                 "encoder_options":"consider_elevation=true|turn_costs=true|block_fords=false|use_acceleration=true",
                 "elevation":true,
                 "preparation":{
                    "min_network_size":200,
                    "min_one_way_network_size":200,
                    "methods":{
                       "ch":{
                          "enabled":true,
                          "threads":8,
                          "weightings":"fastest"
                       },
                       "lm":{
                          "enabled":true,
                          "threads":8,
                          "weightings":"fastest,shortest",
                          "landmarks":24
                       }
                    }
                 },
                 "execution":{
                    "methods":{
                       "astar":{
                          "approximation":"BeelineSimplification",
                          "epsilon":1
                       },
                       "ch":{
                          "disabling_allowed":true
                       },
                       "lm":{
                          "disabling_allowed":true,
                          "active_landmarks":6
                       }
                    }
                 },
                 "ext_storages":{
                    "WayCategory":{

                    },
                    "HeavyVehicle":{
                       "restrictions":true
                    },
                    "WaySurfaceType":{

                    },
                    "Tollways":{

                    }
                 }
              }
           },
           "profile-bike":{
              "profiles":"cycling-regular",
              "parameters":{
                 "encoder_options":"consider_elevation=true|turn_costs=true|block_fords=false",
                 "elevation":true,
                 "preparation":{
                    "min_network_size":200,
                    "min_one_way_network_size":200,
                    "methods":{
                       "ch":{
                          "enabled":true,
                          "threads":8,
                          "weightings":"fastest"
                       },
                       "lm":{
                          "enabled":true,
                          "threads":8,
                          "weightings":"fastest,shortest",
                          "landmarks":24
                       }
                    }
                 },
                 "execution":{
                    "methods":{
                       "astar":{
                          "approximation":"BeelineSimplification",
                          "epsilon":1
                       },
                       "ch":{
                          "disabling_allowed":true
                       },
                       "lm":{
                          "disabling_allowed":true,
                          "active_landmarks":6
                       }
                    }
                 },
                 "ext_storages":{
                    "WayCategory":{

                    },
                    "WaySurfaceType":{

                    },
                    "HillIndex":{

                    },
                    "TrailDifficulty":{

                    }
                 }
              }
           },
           "profile-pedestrian-walk":{
              "profiles":"foot-walking",
              "parameters":{
                 "encoder_options":"consider_elevation=true|turn_costs=true|block_fords=false",
                 "elevation":true,
                 "preparation":{
                    "min_network_size":200,
                    "min_one_way_network_size":200,
                    "methods":{
                       "ch":{
                          "enabled":true,
                          "threads":8,
                          "weightings":"fastest"
                       },
                       "lm":{
                          "enabled":true,
                          "threads":8,
                          "weightings":"fastest,shortest",
                          "landmarks":24
                       }
                    }
                 },
                 "execution":{
                    "methods":{
                       "astar":{
                          "approximation":"BeelineSimplification",
                          "epsilon":1
                       },
                       "ch":{
                          "disabling_allowed":true
                       },
                       "lm":{
                          "disabling_allowed":true,
                          "active_landmarks":6
                       }
                    }
                 },
                 "ext_storages":{
                    "WayCategory":{

                    },
                    "WaySurfaceType":{

                    },
                    "HillIndex":{

                    },
                    "TrailDifficulty":{

                    }
                 }
              }
           }
        }
     }
  },
  "logging": {
      "enabled": true,
      "level_file": "PRODUCTION_LOGGING.json",
      "location": "/var/log/ors",
      "stdout": true
  }

}
}

FILE: app.config.sample IN openrouteservice\src

{
“ors”: {
“info”: {
“base_url”: "… [REMOVED]
“support_mail”: [REMOVED]
“author_tag”: “openrouteservice”,
“content_licence”: “LGPL 3.0”
},
“services”: {
“matrix”: {
“enabled”: true,
“maximum_routes”: 100,
“maximum_routes_flexible”: 25,
“maximum_search_radius”: 5000,
“maximum_visited_nodes”: 100000,
“allow_resolve_locations”: true,
“attribution”: [REMOVED]
},
“isochrones”: {
“enabled”: true,
“maximum_range_distance”: [
{ “profiles”: “any”, “value”: 50000 },
{ “profiles”: “driving-car, driving-hgv”, “value”: 100000 }
],
“maximum_range_time”: [
{ “profiles”: “any”, “value”: 18000 },
{ “profiles”: “driving-car, driving-hgv”, “value”: 3600 }
],
“maximum_intervals”: 10,
“maximum_locations”: 2,
“allow_compute_area”: true
},
“routing”: {
“enabled”: true,
“mode”: “normal”,
“routing_description”: “This is a routing file from openrouteservice”,
“routing_name”: “openrouteservice routing”,
“sources”: [“openrouteservice/src/main/files/heidelberg.osm.gz”],
“init_threads”: 2,
“attribution”: [REMOVED]
“profiles”: {
“active”: [
“car”,
“hgv”,
“bike-regular”,
“bike-mountain”,
“bike-road”,
“bike-electric”,
“walking”,
“hiking”,
“wheelchair”
],
“default_params”: {
“encoder_flags_size”: 8,
“graphs_root_path”: “graphs”,
“elevation_provider”: “multi”,
“elevation_cache_path”: “cgiar_provider”,
“elevation_cache_clear”: false,
“instructions”: true,
“maximum_distance”: 100000,
“maximum_distance_dynamic_weights”: 100000,
“maximum_distance_avoid_areas”: 100000,
“maximum_waypoints”: 50,
“maximum_snapping_radius”: 400,
“preparation”: {
“min_network_size”: 200,
“min_one_way_network_size”: 200,

          "methods": {
            "lm": {
              "enabled": true,
              "threads": 1,
              "weightings": "fastest,shortest",
              "landmarks": 16
            }
          }
        },
        "execution": {
          "methods": {
            "lm": {
              "disabling_allowed": true,
              "active_landmarks": 8
            }
          }
        }
      },
      "profile-car": {
        "profiles": "driving-car",
        "parameters": {
          "encoder_flags_size": 8,
          "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=false",
          "maximum_distance": 100000,
          "elevation": true,
          "maximum_snapping_radius": 350,
          "preparation": {
            "min_network_size": 200,
            "min_one_way_network_size": 200,

            "methods": {
              "ch": {
                "enabled": true,
                "threads": 1,
                "weightings": "fastest"
              },
              "lm": {
                "enabled": false,
                "threads": 1,
                "weightings": "fastest,shortest",
                "landmarks": 16
              },
              "core": {
                  "enabled": true,
                  "threads": 1,
                  "weightings": "fastest,shortest",
                  "landmarks": 64,
                  "lmsets": "highways;allow_all"
              }
            }
          },
          "execution": {
            "methods": {
              "ch": {
                "disabling_allowed": true
              },
              "lm": {
                "disabling_allowed": true,
                "active_landmarks": 6
              },
              "core": {
                "disabling_allowed": true,
                "active_landmarks": 6
              }
            }
          },
          "ext_storages": {
            "WayCategory": {},
            "HeavyVehicle": {},
            "WaySurfaceType": {},
            "RoadAccessRestrictions": {
              "use_for_warnings": true
            }
          }
        }
      },
      "profile-hgv": {
        "profiles": "driving-hgv",
        "parameters": {
          "encoder_flags_size": 8,
          "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=false",
          "maximum_distance": 100000,
          "elevation": true,
          "preparation": {
            "min_network_size": 200,
            "min_one_way_network_size": 200,

            "methods": {
              "ch": {
                "enabled": true,
                "threads": 1,
                "weightings": "fastest"
              },
              "lm": {
                "enabled": true,
                "threads": 1,
                "weightings": "fastest,shortest",
                "landmarks": 16
              },
              "core": {
                "enabled": true,
                "threads": 1,
                "weightings": "fastest,shortest",
                "landmarks": 64,
                "lmsets": "highways;allow_all"
              }
            }
          },
          "execution": {
            "methods": {
              "ch": {
                "disabling_allowed": true
              },
              "lm": {
                "disabling_allowed": true,
                "active_landmarks": 6
              },
              "core": {
                "disabling_allowed": true,
                "active_landmarks": 6
              }

            }
          },
          "ext_storages": {
            "WayCategory": {},
            "HeavyVehicle": {
              "restrictions": true
            },
            "WaySurfaceType": {}
          }
        }
      },
      "profile-bike-regular": {
        "profiles": "cycling-regular",
        "parameters": {
          "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
          "elevation": true,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "HillIndex": {},
            "TrailDifficulty": {}
          }
        }
      },
      "profile-bike-mountain": {
        "profiles": "cycling-mountain",
        "parameters": {
          "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
          "elevation": true,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "HillIndex": {},
            "TrailDifficulty": {}
          }
        }
      },
      "profile-bike-road": {
        "profiles": "cycling-road",
        "parameters": {
          "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
          "elevation": true,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "HillIndex": {},
            "TrailDifficulty": {}
          }
        }
      },
      "profile-bike-electric": {
        "profiles": "cycling-electric",
        "parameters": {
          "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
          "elevation": true,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "HillIndex": {},
            "TrailDifficulty": {}
          }
        }
      },
      "profile-walking": {
        "profiles": "foot-walking",
        "parameters": {
          "encoder_options": "block_fords=false",
          "elevation": true,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "HillIndex": {},
            "TrailDifficulty": {}
          }
        }
      },
      "profile-hiking": {
        "profiles": "foot-hiking",
        "parameters": {
          "encoder_options": "block_fords=false",
          "elevation": true,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "HillIndex": {},
            "TrailDifficulty": {}
          }
        }
      },

      "profile-wheelchair": {
        "profiles": "wheelchair",
        "parameters": {
          "encoder_options": "block_fords=true",
          "elevation": true,
          "maximum_snapping_radius": 50,
          "ext_storages": {
            "WayCategory": {},
            "WaySurfaceType": {},
            "Wheelchair": {
              "KerbsOnCrossings": "true"
            },
            "OsmId": {}
          }
        }
      }
    }
  }
},
"logging": {
  "enabled": true,
  "level_file": "DEBUG_LOGGING.json",
  "location": "/var/log/ors",
  "stdout": true
}

}
}


FILE: app.config.sample IN docker\config

{
“ors”:{
“info”: {
“base_url”: [REMOVED]
“support_mail”: [REMOVED]
“author_tag”: “openrouteservice”,
“content_licence”: “LGPL 3.0”
},
“services”:{
“matrix”:{
“enabled”:true,
“maximum_locations”:200,
“maximum_visited_nodes”:100000,
“allow_resolve_locations”:true,
“attribution”: [REMOVED]
},
“isochrones”:{
“enabled”:true,
“maximum_range_distance”:[
{
“profiles”:“any”,
“value”:50000
},
{
“profiles”:“driving-car, driving-hgv, cycling-regular, foot-walking”,
“value”:100000
}
],

[cut due stay under maximum length of post]

I don’t mean to be condescending: but seriously… it takes 2 seconds to look up where those coordinates are. Seeing how the coordinates are in Berlin, the next question should be apparent: did you load Berlin data? No: how you expect them to succeed?

Ok, now anyways, the tree output doesn’t show any data. The directories are less interesting than the data residing in each of them, e.g. I don’t know if asia-latest.osm.pbf actually is there. I guess so, but would like to be sure.

Looks actually ok, but to be sure: Did you rebuild the image? If not, please do that now. Then spawn another container from that new ORS image and see if that makes things right. Also, you might want to build less profiles. Asia has 8 GB, if you build 4 profiles on one single server, you’d need at least 128 GB RAM. If you have that, awesome, if not, try one profile per server. And adjust your Xms1g -Xmx2g of course…

Nils, I apologize.

I did see those points were in or near Berlin but assumed incorrectly that the Berlin pub crawl was a tutorial for people who had just installed openrouteservice. For that reason, I thought the points should be in the initial data. Completely my fault.

I just used points near the center of Heidelberg and received a route, so you were correct. For some reason, my rebuild of the image did not work. Docker\data\asia-latest.osm.pbf is indeed 8.3GB and I don’t have enough RAM for 4 profiles. I’ll either build fewer profiles or find data for just the part of China we are looking at.

This is the first docker product I’ve used. When you write “spawn another container from that new ORS image” are these the steps?

  1. edit yaml to point to new data (“OSM_FILE: ./docker/data/asia-latest.osm.pbf”)
  2. delete “docker/graphs” (old data)
  3. issue “docker-compose up -d” (build graphs with new data and start server)

-david

I don’t think you even rebuilt the image ever. So, you need to:

  1. read up a little about docker;) it’s good, trust me and if you’re doing services now and then, you’ll love it
  2. docker-compose up -d --build, the --build is really important. it basically does a docker build before starting new containers. You need to see that it’s building, it will tell you. If it only says, container xxx created, it didn’t work and I’d try to rename the service in docker-compose.yml from ors-app to smth else.

Also, pls remove all containers you created so far for ors, just to be safe.

Other than that your plan looks fine, especially deleting the graphs is really important!

Thanks. I’ll follow your advice!

np, let me know if it worked.