ResponsePath/InstructionList to GPX/JSON

Hello everyone,
I’m using only offline java GH lib, but I wish to get routing result in GPX or JSON format (for export to another project), like GH Web API (or even Driving Directions - GraphHopper Maps) does. Is custom manual parsing & serialization of ResponcePath and InstructionList the only option for me to do this, or I missed something and there is some nice and easy way?
Thanks in advance!

Yes this is done on the server side, so you can just use the same code. Take a look at this code: https://github.com/graphhopper/graphhopper/blob/86d23a3131fb7f65706f2a52ff23bfe250d27c48/web-bundle/src/main/java/com/graphhopper/resources/RouteResource.java#L244-L254

1 Like

Thanks for fast reply, gonna try it…

errr, sorry, what imports should I use (or extra maven dependencies maybe)?
got it, it’s in “web-bundle” package…

upd: works ok, thanks a lot!

Powered by Discourse