Tuesday, March 23, 2010

Ain't No Mountain High Enough...

Lombard Street, San Francisco is featured on a million postcards as "the crookedest street in the world" due to the 8 hairpin bends on the block between Hyde and Leavenworth Streets. The famous turns are clearly visible on a map, but it is not obvious why they are necessary. And the rest of Lombard St looks like an innocent section of straight road from above.

However, it was while driving along the section of Lombard St west of Hyde that I was first introduced to the smell of a burning clutch. I was stuck in traffic in a car with manual transmission trying to drive up what is actually an incredibly steep hill, one of many in San Francisco. But apart from the shading in Terrain view there is no way to appreciate that on a map unless you switch to Street View.

We are therefore happy to introduce a new service to the Maps API family that enables applications to determine elevation profiles. Using either the new ElevationService Maps API v3 class or the Elevation Web Service you can request the elevation in meters for one or more sets of coordinates, or you can request a specific number of elevation samples equally spaced along a path. If any sampling points are over bodies of water, the service will return the depth relative to sea level as a negative number.

The below application uses the Google Visualization API to plot elevation profiles. You can add additional points by clicking on the map or entering an address, drag existing points arounds, and switch between different modes of travel. If you roll your mouse over the profile chart you can see on the map the point that the given sample relates to.

To facilitate easy generation of elevation profiles for routes generated for driving, cycling, or walking directions we have also added a new property to the DirectionsResult object called overview_path. This is a simplified path guaranteed to be short enough to pass to the Elevation Service.

As with all other Google Maps API services, the elevation service must be used in compliance with the Maps API Terms of Service which require that it be used in conjunction with display of a Google map. This means that if you display elevation information to your users that you have obtained using this service, or any data that you have derived from it, you must also show a Google map that indicates the points, path, or route concerned.

We think that this new elevation service is a natural complement to our recently launched bicycling directions. Now you can determine in advance just how painful your bicycling route is likely to be. In fact you’ll be happy to hear that the Maps API bicycling directions already factor in elevation, which is why if you ask for a route up Lombard Street you will be sent the long way round.