Fix POI distance calculation: OSRM index separator and error handling
- Fix OSRM client to use semicolons (not commas) for source/destination indices in /table API requests. Commas caused "Query string malformed" errors for any batch with more than one origin. - Add error handling in poi_distance_calculator for unreachable routing engines (OSRM/OTP). Connection failures now log an error and skip the mode instead of crashing the entire Celery task.
This commit is contained in:
parent
7084c46f89
commit
8a5d1b3787
2 changed files with 25 additions and 16 deletions
|
|
@ -47,8 +47,8 @@ async def osrm_table(
|
|||
coords_str = ";".join(f"{lng},{lat}" for lng, lat in all_coords)
|
||||
|
||||
# Source/destination indices
|
||||
source_indices = ",".join(str(i) for i in range(len(origins)))
|
||||
dest_indices = ",".join(str(i) for i in range(len(origins), len(all_coords)))
|
||||
source_indices = ";".join(str(i) for i in range(len(origins)))
|
||||
dest_indices = ";".join(str(i) for i in range(len(origins), len(all_coords)))
|
||||
|
||||
url = (
|
||||
f"{base_url}/table/v1/{profile}/{coords_str}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue