So my gut feeling is that bounds is the start and end points of the envelope and the envelope describes points along the road. But I don’t understand how the coordinates work, my cursory googling is pointing me to a little ways off the coast of Somalia.
I can’t seem to find a blog post or piece of documentation that explains how to map these values.
The points are lines. They tend to go along the direction of a road. We map them as lines and put a an area around them to create a complex polygon. The maths for creating the polygons from series of lines is non-trivial
The first coordinate is the longitude and the second number in each pair is the latitude. You need to use various geospatial techniques to accurately map them to a curved surface. For many small distances, simple trigonometry works, but if you’re doing anything over a few miles, you need to do the maths properly.
You can see what we do by searching for #jambusterlondon on Twitter. The coloured areas shows the coordinate mapping. Our apps also use this but do a lot more.
Hope that helps,
Here’s a few pictures, each of these have two lines in them. We optimise some pictures to speed up image generation
It’s tricky. TfL also embeds lines inside the JSON at different levels so you can’t assume the JSON has just two levels. Also the lines don’t always work contiguously.
We ended up writing a lot of code to handle geospatial calculations. If you are using Openstreetmap or similar then you need to be accurate on your calculations as any graphics will simply be wrong.
If you look at the images above you can see that the middle of the radius of each curve is on a road, if you get that wrong a) it looks rubbish b) it’s wrong!