Search code examples
dockeropenstreetmapgeocodingopenrouteservicepelias

Self-hosted OpenRouteService (Python) geocoding error


I am using Docker to host openrouteservice. I am trying to get from the string representation of this address to a set of coordinates. For this I found out you need pelias_search, but for some reason it throws an error and I can't find what's wrong. The only thing I found that's off is that in the openrouteservice folder (git clone to compose for Docker) the folder docker/data is empty, which I think shouldn't be.

The address you see below is just some random Belgian address and I have the Belgian map downloaded.

import openrouteservice as ors

ors_client = ors.Client(base_url='http://localhost:8080/ors')

# just to show that this works
coordinates_var = [(3.4369783, 51.1306368), (3.4860564, 51.0838975)]
# random Belgian coordinates
route = ors_client.directions(coordinates=coordinates_var, profile='driving-car', format='json')
print(route)

address = 'Tienbergen, Asse, VB, Belgium'
# I have tried other formats. This is from their own map website.

# This throws the error
response = ors_client.pelias_search(text=address)

# error: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
# openrouteservice.exceptions.HTTPError: HTTP Error: 404

Solution

  • Not sure if this answers your problem, but it looks like the docker version of OSR does not include several services offered by their hosted API:

    From the readme:

    And to avoid any misunderstandings, it should also be mentioned at this point that our live API provides several other endpoints that are not part of the openrouteservice software/repository:

    • openpoiservice: A stand-alone service from HeiGIT that returns points of interest in the area surrounding a geometry
    • openelevationservice: A stand-alone service from HeiGIT that returns the elevation for point or line geometries
    • Pelias: A (reverse) geocoder hosted by HeiGIT that resolves geographic coordinates to addresses and vice versa
    • VROOM: The Vehicle Routing Open-source Optimization Machine hosted by HeiGIT