I already managed to return geometries of Isochrones using the API as follows:


Now I'd like to also return requested routes via OpenTripPlanner REST-API as line geometry which can be loaded into a GIS.


returns the route as JSON, but not its geometry.

I already tried different URLs as described in the API-Docs here: http://dev.opentripplanner.org/apidoc/1.0.0/resources.html, but so far I wasn't able to return a route geometry.

Is it possible to return the geometry of a route using OpenTripPlanner API and if so, how?


plan resource returns an encoded polylinestring.

This can be turned into 'actual geometry' using scripts from this Stack Overflow question: https://stackoverflow.com/questions/9217274/how-to-decode-the-google-directions-api-polylines-field-into-lat-long-points-in/22737305

There are working ports for python, VBA, Java, ...

These can be used to create a GeoJSON file of the route.

| improve this answer | |

If you are an R user you could use https://docs.ropensci.org/opentripplanner/

You can then save out the results in a QGIS compatible format

otpcon = otp_connect()
mydata = otp_plan(otpcon, from, to)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.