{"message":"Invalid input. At least 2 points for Map Matching API have to be specified but was: 0"}

Hi,

I am trying to use the Map Matching API to snap some inaccurate GPS measurements to a road. I am trying an example file with a few samples, but I am getting the error {“message”:“Invalid input. At least 2 points for Map Matching API have to be specified but was: 0”} . I don’t really understand this error as the file has right now 6 points. I have checked the examples in the documentation and the format of the GPX file is correct. Can someone point me to a possible source for this error?

Additional Info:

Host: graphhopper.com
user-agent: insomnia/2020.4.2
content-type: application/gpx+xml
accept: /
content-length: 296

I posted this towards the official API:

curl -XPOST -H "Content-Type: application/gpx+xml" "https://graphhopper.com/api/1/match?key=YOUR_KEY&vehicle=car" --data @test.gpx

And the problem persists.

Can you post the file here? Is the GPX example in the documentation working for you?

Yes. I could not attach it yesterday since I just regirstered in the forum. Here it is.
test.gpx (206 Bytes)

I managed to get a different result now when posting from my command line. So I am assuming it is working now, but I just don’t know how to see it in a graphical interface and extract the snapped GPS coordinates? I am using this as a tool for my actual work and I am very new on this, so apologies for the ignorance!

I get this when posting the aformentioned command in my command line:

{“hints”:{},“info”:{“copyrights”:[“GraphHopper”,“OpenStreetMap contributors”],“took”:0},“paths”:[{“distance”:20.366,“weight”:9.223372036854775E12,“time”:3927,“transfers”:0,“points_encoded”:true,“bbox”:[9.928736,57.045454,9.928979,57.045564],“points”:“wud{Iagr{@PVBV”,“instructions”:[{“distance”:12.807,“heading”:215.86,“sign”:0,“interval”:[0,1],“text”:“Continue onto L├©kkegade”,“time”:2881,“street_name”:“L├©kkegade”},{“distance”:7.559,“sign”:1,“interval”:[1,2],“text”:“Turn slight right onto Danmarksgade”,“time”:1046,“street_name”:“Danmarksgade”},{“distance”:0.0,“sign”:4,“last_heading”:264.19083933482256,“interval”:[2,2],“text”:“Arrive at destination”,“time”:0,“street_name”:""}],“legs”:[],“details”:{},“ascend”:0.37150025367736816,“descend”:0.1875,“snapped_waypoints”:""}],“map_matching”:{“original_distance”:20.65168424680574,“distance”:20.36601451308279,“time”:3927}}

Thanks a lot!

but I just don’t know how to see it in a graphical interface and extract the snapped GPS coordinates?

You can have a look into this JS code: https://github.com/graphhopper/directions-api-js-client#graphhopper-map-matching-api and here is the client https://github.com/graphhopper/directions-api-js-client/blob/master/src/GraphHopperMapMatching.js

The important part is probably to convert the polyline (in your example "points":"wud{Iagr{@PVBV") - you can do this via the decode function in the JS code or less efficient would be to specify &points_encoded=false when POSTing the data.

Powered by Discourse