ustroetz / python-osrm

A Python wrapper around the OSRM API
MIT License
133 stars 55 forks source link

Bad request #42

Open Rougree opened 4 years ago

Rougree commented 4 years ago

Hi, I have problems with the osrm table. If I apply the following code:

################################################## import osrm import pandas as pd from osrm import Point

ams = Point(longitude=52.370216, latitude= 4.895168) delft = Point(longitude= 52.0115769,latitude= 4.3570677)

list_coord = [ams, delft]

list_id = ['Ams', 'Delft']

osrm.RequestConfig.host = osrm.RequestConfig.host = "router.project-osrm.org"

time_matrix, snapped_coords, a = osrm.table( list_coord, ids_origin=list_id, output='dataframe')

time_matrix #################################################

I have the following error:

######################################################## runfile('C:/Users/RSale/OneDrive/Bureaublad/Thesis/Thesis_Python/proberen.py', wdir='C:/Users/RSale/OneDrive/Bureaublad/Thesis/Thesis_Python') Traceback (most recent call last):

File "C:\Users\RSale\OneDrive\Bureaublad\Thesis\Thesis_Python\proberen.py", line 26, in list_coord, ids_origin=list_id, output='dataframe')

File "C:\Users\RSale\Anaconda3\lib\site-packages\osrm\core.py", line 348, in table rep = urlopen(req)

File "C:\Users\RSale\Anaconda3\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout)

File "C:\Users\RSale\Anaconda3\lib\urllib\request.py", line 532, in open response = meth(req, response)

File "C:\Users\RSale\Anaconda3\lib\urllib\request.py", line 642, in http_response 'http', request, response, code, msg, hdrs)

File "C:\Users\RSale\Anaconda3\lib\urllib\request.py", line 570, in error return self._call_chain(*args)

File "C:\Users\RSale\Anaconda3\lib\urllib\request.py", line 504, in _call_chain result = func(*args)

File "C:\Users\RSale\Anaconda3\lib\urllib\request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: Bad Request #################################################################

If I use osrm.simple_route I have no error... Does anyone know what is going wrong?