Displaying Elevations on Google Maps
Russell Degnan

For the past month or so I only seem to have been doing three things: marking assignments, attending weddings and going for bike rides. Unfortunately there was far too much of the first and not near enough of the latter. Marking is practically finished now, and I won't be teaching for a while to focus on finding that elusive thesis question.

The bike riding will hopefully continue though, with the plan to have more long rides, especially now that I've ridden around most of the paths the city has to offer. Finding places to ride can be extremely annoying though. Google Maps is really good at giving you a route and a distance, and has a pretty cool terrain viewer to give a sense of the hills, but not perfect for other important bike things.

Firstly, the route finder gives the fastest route, which means the main-est road route. Since I'd prefer to avoid main roads, what I'd really like (and can't get) is a sense of road quality. A route finder that confines itself to sealed roads would be handy. Information on the map detailing whether a road has a shoulder, or a bike lane would also be helpful. Doubly so if it could tell me what roads are smooth, instead of long wearing too. I'm not sure what it is like for cars, but I notice a 10-15% difference in effort between the asphalt of highway road surfaces, and that normally used for bike paths.

Route finding for bikes is possible with the proper GIS information, and I'm working on that in a more general way, mfor more research type reasons, already. Writing my own route finder to plug into Google Maps is possible (even likely), but not quite yet. I'd need to look into a dedicated server to handle the processing.

Secondly, although there is a pretty handy terrain viewer, it is not easy to read contour lines to calculate hills Particularly winding roads where the distance is hard to calculate, it needs to be at full zoom to see them properly.

I can do something about this though. Google Maps has a pretty good API for playing with its stuff. Very good actually, and it isn't until you get into it that you realise how cool it is, and how easy it is to do some funky stuff (though a few things I wanted to do meant rewriting slabs of functionality). Unfortunately, Google doesn't tell you the elevation at different coordinates. As with route fnding, with a dedicated server and proper GIS information I could find this easily enough, but not yet.

Fortunately, Topocoding has a clean and hard working API of their own, providing data to 90m world wide. Combine that with Google's route finder, some Walter Zorn's drawing tools and some (possibly also server intensive) PHP back-end coding, and the result is (I think) worth a few days of effort:

I am not sure what the image processing is doing to my hosting service (it is very slow, but that might be a coding error). Topocoding limits the number of requests it allows anyway, so the full working model might get reserved for my personal purposes in the event of unexpected popularity. Please note: working out the route, and setting the scale before getting the elevation makes a big difference to your wait times.

It is a funky plaything though. That's the Tour de France's brutal tour decider over L'Alpe d'Huez above. For the benefit of significantly more of my readers, here is the link to the significantly easier, but more familiar, climb up Northcote Hill

Passing Fancy 12th August, 2008 17:44:32   [#] 

Comments