Hello, I’ve made a little python code to try out the map matching api, using a test gps file made with the gpxpy library. To do this, I made a fairly large test .gps file that looks (with some points removed) like this:
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="gpx.py -- https://github.com/tkrajina/gpxpy">
<trk>
<trkseg>
<trkpt lat="46.484927" lon="6.351695">
<ele>583.0606079101562</ele>
<time>2018-01-08T08:11:59Z</time>
</trkpt>
<trkpt lat="46.484865" lon="6.351457">
<ele>586.5311889648438</ele>
<time>2018-01-08T08:12:00Z</time>
</trkpt>
<trkpt lat="46.484831" lon="6.351277">
<ele>589.6990356445312</ele>
<time>2018-01-08T08:12:01Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>
But when I try to use the API with this code :
url = "http://localhost:8989/match?profile=car&type=json"
headers = {"Content-Type": "application/gpx+xml"}
data = open("data/test.gpx", "rb").read()
response = requests.post(url, headers=headers, data=data)
matched_data = response.json()
print(matched_data)
I get : {‘message’: ‘Sequence is broken for submitted track at initial time step.’, ‘hints’: [{‘message’: ‘Sequence is broken for submitted track at initial time step.’, ‘details’: ‘java.lang.IllegalArgumentException’}]}
I’ve searched a bit and tried different GPS files but I still haven’t figured out how to solve the problem.