How to get matched position of each GPS position?

I am sending gpx file to the match endpoint and map matching works perfectly. But I also want to know matched position of each gps position, output returns fewer points than I sent.
Is it possible?

Request: localhost:8989/match?profile=car&type=json&points_encoded=false&instructions=false

Output:

{
    "hints": {},
    "info": {
        "copyrights": [
            "GraphHopper",
            "OpenStreetMap contributors"
        ],
        "took": 0
    },
    "paths": [
        {
            "distance": 3176.536,
            "weight": 9.223372036854775E12,
            "time": 410185,
            "transfers": 0,
            "points_encoded": false,
            "bbox": [
                9.706653,
                49.065775,
                9.730426,
                49.073012
            ],
            "points": {
                "type": "LineString",
                "coordinates": [
                   ...
                ]
            },
            "legs": [],
            "details": {},
            "ascend": 0.0,
            "descend": 0.0,
            "snapped_waypoints": {
                "type": "LineString",
                "coordinates": []
            }
        }
    ],
    "map_matching": {
        "original_distance": 3654.735977915633,
        "distance": 3176.536248089889,
        "time": 410185
    }
}

As per my understanding the output isn’t snapping your input gps pings on the road, in fact it is a line string which represents connected road segments, the way I map the input points back to the road segment is by using interpolation approach (connecting the input point to the output linestring and the intersecting point is the mapped point)

1 Like

Looks like it is the only solution, it would be cool if graphhopper can do this out of the box.

Powered by Discourse