Can't load .gpx file

I tried posting a .gpx file to my map-matching server (i obtained it under source - test). I used the following command: curl -XPOST -H “Content-Type: application/gpx+xml” -d DIR\GPX_data\tour2-with-loop.gpx “localhost/match?vehicle=car&type=json” and i get the following error:

java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
        at com.graphhopper.matching.GPXFile.doImport(GPXFile.java:175)
        at com.graphhopper.matching.http.MatchServlet.parseGPX(MatchServlet.java:

The map matching server compiled normally. GPX file has no characters before “<?xml …”. I tried to use the solution from: http://stackoverflow.com/questions/3030903/content-is-not-allowed-in-prolog-when-parsing-perfectly-valid-xml-on-gae. I converted the InputStream to String, followed the instructions and converted back to InputStream but no success. Anyone had any similar problems or has any idea what do to?

Did you specify the correct port like specified in the readme?

Yes, the port is same as default (8989).

But you are not using it in the curl command. use localhost:8989/match … there

I was just trying to censor IP and i also deleted the port accidentally. But i do have it in my original curl command:
curl -XPOST -H “Content-Type: application/gpx+xml” -d SOME_DIR\tour2-with-loop.gpx “SOME_IP:8989/match?vehicle=car&type=json”

Please try on your local machine first to avoid any firewall issues etc

Do you see the web UI and can post GPX files there? What does curl localhost:8989/info say?

I am on linux machine and i only have remote access via ssh. But i managed to solve it. I just had to change the host in demo.js to get it working through UI. In curl request i had a syntax error. This one should work: curl -XPOST -H “Content-Type: application/gpx+xml” -d **@**tour2-with-loop.gpx “SOME_IP:8989/match?vehicle=car&type=json”.

1 Like

Thanks for digging deeper and solving this issue!