Problems with "Invalid input" in Map Matching API

Hey,
im trying to use the MapMatching-Api, but I always get this error:
Invalid input. At least 2 points for Map Matching API have to be specified but was: 0

I use this gpx file:
test.gpx (248 Bytes)

Can you provide a working gpx file or tell me whats wrong with mine?

Thank you!

It should work:

Make sure you imported the area before doing the map matching and you use a proper vehicle and GPS accurracy

what you mean with import the area?

i have all parameters and posting to the official api

If you post the GPX to the official API (Have changed the category accordingly), then there can be only a client or usage problem. How do you POST the data to the Map Matching API?

simulating it with PAW at the moment.

Raw Request:

POST /api/1/match?vehicle=car&key=xxx&gps_accuracy=50 HTTP/1.1
Content-Type: application/octet-stream
Host: graphhopper.com
Connection: close
User-Agent: Paw/3.1.5 (Macintosh; OS X/10.13.6) GCDHTTPRequest
Content-Length: 248

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gpx version="1.1" >
<trk>
<name>Test route</name>
<trkseg>
<trkpt lon="13.720673" lat="51.038295">
</trkpt>
<trkpt lon="13.720778" lat="51.038371">
</trkpt>
</trkseg>
</trk>
</gpx>

I fear it is a client problem. This is definitely wrong:

Content-Type: application/octet-stream

Can you try this with curl?

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

it was the content type
with curl its working, thanks a lot!

1 Like

Hi, I am currently having the same problem and I am using the right curl. I have used the attached file in this post (test.gpx) for testing that it was not a problem of my gpx file, and still have the same message: {“message”:“Invalid input. At least 2 points for Map Matching API have to be specified but was: 0”}.

Any chance someone can point me to the error?

Thanks.

If you post this towards the official API it will work.

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

Will close this old topic. Please just create a new topic if there is still a problem or question.