I'm using the OpenTripPlanner Planner API to find directions.

The API returns XML with the geometry of the line (2D) and the elevation data separately, for example

The 2D line geometry is as encodedPolylineBean in:


And looks something like


But the elevation data is in:


And Looks like:


What I don't understand is:

  1. What is the difference between the <first> and <second> elevation?
  2. Why when the PolylineBean line is decoded does it have fewer points than the number of values given for the elevation?

For reference, a full XML response is available here

1 Answer 1


I have now found out that the answer is:

First - is the distance along the leg (i.e. it resets to 0 after each leg)

Second - is the elevation

The elevation points don't correspond directly to points on the PolylineBean but can be interpolated by calculating the length along the line.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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