O'Reilly logo

Google Maps JavaScript API Cookbook by Balkan Uraz, Alper Dincer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding the bicycling layer

It is good to have the information about the cycling paths and common routes on top of base maps; Google Maps offers this as an overlay layer.

In this recipe, we will introduce the bicycling layer and its usage as an overlay in the Google Maps JavaScript API.

Getting ready

Continuing from the previous recipe, Adding the traffic layer, will simplify our work, as we will only replace the TransitLayer object with the BicyclingLayer classes. Remember to copy the code of the original recipe.

How to do it…

The steps required for showing the cycling paths and routes are presented as follows:

  1. Change the two lines containing TransitLayer, supplanting the BicyclingLayer object instead of the TransitLayer object:
     var bicyclingLayer = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required