Replies: 3 comments
-
If you're using You don't say what kind of crash you're experiencing - is it an OOM error (typically, you'll see a message like For distance and duration, look at the |
Beta Was this translation helpful? Give feedback.
-
@danpat Thanks for the solution. The server was crashing because of memory issue, but I need to overcome this by making multiple smaller /table request. This the code which I am using for construction of smaller /table request. longLat_list_3000= "lat-longs......."
lat-long = longLat_list_3000.split(";")
res_list = []
for i in lat-long:
table = []
for j in range(0, len(lat-long), 500):
batch = result1[j:j + 500]
batch.insert(0, i)
table.append(batch)
res_list.append(table)
def osrm(lat_long):
result2 = []
result1 = []
for value in lat_long:
data = ";".join(value)
url = "{}{}?sources=0&annotations=distance".format("http://server-ip/table/v1/driving/", data)
response = requests.get(url)
res1 = response.json()
result1.append(res1['distances'][0])
res2= []
for j in result1:
res2.extend(j[1:])
result2.append(d2) I need more clarification on the code side using python. Can you share me the code for achieving the above issue? I am using the below URL to get the durations and distances. url = "{}{}?sources=0&annotations=distance".format("http://server-ip/table/v1/driving/", latitude_longitude) Kindly suggest that what I am doing wrong in code. |
Beta Was this translation helpful? Give feedback.
-
Years ago, I wrote this in Javascript: https://gist.github.com/danpat/83eaed80b6241310ebdf1c0bef04a524 The Mapbox Matrix API has the same API interface as OSRM, so you can adapt that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, Good day
Issue
I have an issue with the GET request made to an OSRM for the 3000 co-ordinates to get duration and distance. I am using table/v1/driving endpoint to get the response.
The server(8GB) is crashing for the large amount of data(3000) has been sent for the request.
Is there any alternative HTTP requests method for the large amount of data(>3000)?
Is there any way to get the distance and duration to each P2P location?
Kindly help me with the above mentioned problem.
Beta Was this translation helpful? Give feedback.
All reactions