GraphHopper.com | Forum | GitHub | Maps | Blog

Problems with "Invalid input" in Map Matching API


#1

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!


#2

It should work:

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


#3

what you mean with import the area?

i have all parameters and posting to the official api


#4

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?


#5

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>

#6

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

#7

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