1

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:

response
.plan
..intineraries
...legs
....legGeometry
.....points

And looks something like

wnseIhqzL??DCl@m@b@m@lA}AjB}B`@g@d@q@\\i@l@y@Vc@vAqCbAeCvAsDx@qBdCaG^{@DGr@_AxFiAjDcAv@]jAg@h@WlBcA\\Sz@c@@RPxA@`@Ad@Ex@@NDJBJ^dATp@h@xCBN^x@h@jAX^`AhApAzAbAfAfAhAtAxA|AfArBl@|Ad@vAXxCrAt@X^Vn@`@pA`ApA`AvAdAzAd@\\Ep@KFAbDgAhBwBnBkCBE`@i@p@_@t@a@zAa@VGzAw@x@jCn@pBFPNf@j@dBvAxDHTXz@lAfDvA|D?D`BfFz@hCFPz@nCdA~CQb@

But the elevation data is in:

response
.plan
..intineraries
...leg
....steps
.....elevation

And Looks like:

<elevation>
  <first>5.322</first>
  <second>73.87</second>
</elevation>
<elevation>
  <first>15.322</first>
  <second>74.25</second>
</elevation>
<elevation>
  <first>25.322</first>
  <second>74.56</second>
</elevation>
<elevation>

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

0

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, privacy policy and cookie policy

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