Node ids rounded off in v6.0.0 in map matching and output is also in float
Issue
When i created the docker image using v6.0.0 and then tried the following map matching code then i am getting osm nodes in floating point and these are not even in India even though my pbf file is of India.
import requests
import json
def get_osrm_match(geo_coords, port_number=5000):
"""
Matches given GPS coordinates to the nearest roads using OSRM map matching.
Args:
geo_coords (list of tuples): A list of coordinates (latitude, longitude, timestamp).
port_number (int, optional): The OSRM server port number. Defaults to 5000.
Returns:
tuple:
- decoded_geometry (list of tuples): Route geometry as a list of (lat, lon).
- matched_geometry (list of tuples): Final matched coordinates to the corresponding geo coords.
- snap_distance (float): Total distance (in meters) between the original and matched points.
- location_type_list (list of dicts): Detailed information about each tracepoint and OSM node in the matched trace.
"""
# Construct OSRM request URL and parameters
osrm_route_url = f"http://127.0.0.1:{port_number}/match/v1/driving/"
map_matching_radius = 20
# Format the coordinates for the OSRM request
loc = ';'.join([f"{coord[1]},{coord[0]}" for coord in geo_coords])
radii = ';'.join([str(map_matching_radius)] * len(geo_coords))
# Build the final request URL
url = (f"{osrm_route_url}{loc}?overview=full&radiuses={radii}"
"&generate_hints=false&skip_waypoints=false&gaps=ignore"
"&geometries=geojson&annotations=nodes")
try:
# Send the GET request to the OSRM server
request_output = requests.get(url)
except Exception:
return None, None, None, None # Return empty results on failure
# Check if the request was successful
if request_output.status_code != 200:
return None, None, None, None
# Parse the response from the OSRM server
response = request_output.json()
return response
geo_coords = geo_coords = [[28.609423, 77.045058, 1759296437014.0], [28.609437, 77.0449, 1759296555105.0]]
response = get_osrm_match(geo_coords, port_number=5000)
print(json.dumps(response, indent=4))
Output using v6.0.0 (stable since last 7 months):
{
"code": "Ok",
"matchings": [
{
"confidence": 2.097487991e-05,
"legs": [
{
"distance": 20.2,
"annotation": {
"nodes": [
7232674578,
12252920890.0,
9918335465
]
},
"duration": 3,
"summary": "",
"weight": 3,
"steps": []
}
],
"weight_name": "routability",
"geometry": {
"coordinates": [
[
77.044764,
28.609622
],
[
77.044764,
28.609622
],
[
77.044759,
28.60944
]
],
"type": "LineString"
},
"weight": 3,
"duration": 3,
"distance": 20.2
}
],
"tracepoints": [
{
"waypoint_index": 0,
"matchings_index": 0,
"name": "",
"alternatives_count": 4,
"location": [
77.044764,
28.609622
],
"distance": 36.23505615
},
{
"waypoint_index": 1,
"matchings_index": 0,
"name": "",
"alternatives_count": 7,
"location": [
77.044759,
28.60944
],
"distance": 13.79218809
}
]
}
output using v5.27.1 (stable since last 3 years):
{
"code": "Ok",
"matchings": [
{
"confidence": 2.097487991,
"geometry": {
"coordinates": [
[
77.044764,
28.609622
],
[
77.044764,
28.609622
],
[
77.044759,
28.60944
]
],
"type": "LineString"
},
"legs": [
{
"steps": [],
"summary": "",
"weight": 3,
"duration": 3,
"annotation": {
"nodes": [
7232674578,
12252920893,
9918335465
]
},
"distance": 20.2
}
],
"weight_name": "routability",
"weight": 3,
"duration": 3,
"distance": 20.2
}
],
"tracepoints": [
{
"alternatives_count": 4,
"waypoint_index": 0,
"matchings_index": 0,
"distance": 36.235056148,
"name": "",
"location": [
77.044764,
28.609622
]
},
{
"alternatives_count": 7,
"waypoint_index": 1,
"matchings_index": 0,
"distance": 13.792188086,
"name": "",
"location": [
77.044759,
28.60944
]
}
]
}
As you can see the ouptut "12252920890.0," in v6.0.0 is not a valid osm node and even without float if you check it without floating part its some node in US (Link)
The thing is the correct node is "12252920893" from v5.27.1 and it has been rounded off in v6.0.0 i guess "12252920890.0" like 3 units difference right?
I have also attached the osrm setup script here. start_osrm_docker.sh
So please tell me what is the issue and how can i fix it? Or should i use the older v5.27.1 only?
@asaveljevs @DennisOSRM if possible could you guys please look into this? it would be really helpful.. thank you
or if there are some updated commands that we must use while starting the osrm docker with v6.0.0 then also please let us know.
@DennisOSRM if possible could you please confirm if this issue is valid or not? Maybe we need some updated docker command other than the ones shared in the attached "start_osrm_docker.sh" file for v6? So that we can decide which version to use.
Have you tested your URL call against https://router.project-osrm.org/match/v1/driving/.../&generate_hints=false&skip_waypoints=false&gaps=ignore&geometries=geojson&annotations=nodes and do you get an outside of India response there as well?
@afarber Yes.. the same floating point issue and rounding off issue is present in the live public version at: "https://router.project-osrm.org/match/v1/driving/" as of 16th Nov 2025. If possible kindly fix this. Thank you.
{
"code": "Ok",
"matchings": [
{
"confidence": 2.097487991e-05,
"legs": [
{
"distance": 20.2,
"annotation": {
"nodes": [
7232674578,
12252920890.0,
9918335465
]
},
"duration": 3,
"summary": "",
"weight": 3,
"steps": []
}
],
"weight_name": "routability",
"geometry": {
"coordinates": [
[
77.044764,
28.609622
],
[
77.044764,
28.609622
],
[
77.044759,
28.60944
]
],
"type": "LineString"
},
"weight": 3,
"duration": 3,
"distance": 20.2
}
],
"tracepoints": [
{
"waypoint_index": 0,
"matchings_index": 0,
"name": "",
"alternatives_count": 4,
"location": [
77.044764,
28.609622
],
"distance": 36.23505615
},
{
"waypoint_index": 1,
"matchings_index": 0,
"name": "",
"alternatives_count": 7,
"location": [
77.044759,
28.60944
],
"distance": 13.79218809
}
]
}