# Google Map V3 骑行图层

**URL:** <https://www.isharkfly.com/t/google-map-v3/8969>\
**Category:** 前端\
**Created:** [March 8, 2013, 3:49am UTC](https://www.isharkfly.com/t/google-map-v3/8969 "2013-03-08T03:49:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [March 8, 2013, 3:49am UTC](https://www.isharkfly.com/t/google-map-v3/8969/1 "2013-03-08T03:49:57Z")

</div>

在 Google Maps API 中，您可以使用 BicyclingLayer 对象向地图添加骑行信息。BicyclingLayer 用于在给定地图的顶部呈现一个骑行路径、推荐骑行路线以及骑行专用的其他叠加层的图层。

此外，该图层会更改基本地图本身的样式，以突出显示支持骑行路线的街道，并弱化显示不适合骑行的街道。

以下示例在麻萨诸塞州剑桥的地图上显示了支持的骑行图层：

 ![](https://com-ossez-www-discourse.s3.dualstack.us-east-2.amazonaws.com/discourse-uploads/original/2X/2/2536b67e82317c633faeb808325b80bf3bf15923.jpeg)

在线示例程序的地址：  
[http://src.ossez.com/filedetails.php?repname=p&path=%2Fgmaps%2Fv3%2Fexamples%2Ftrunk%2Flayer-bicycling%2Flayer-bicycling.html](http://src.ossez.com/filedetails.php?repname=p&path=%2Fgmaps%2Fv3%2Fexamples%2Ftrunk%2Flayer-bicycling%2Flayer-bicycling.html)

程序代码如下：[code]

OSSEZ Google Maps JavaScript API v3 Example: 骑行地图 html,body { height: 100%; margin: 0; padding: 0; }

#map\_canvas {  
height: 100%;  
}

@media print {  
html,body {  
height: auto;  
}  
#map\_canvas {  
height: 650px;  
}  
}

 function initialize() { var myLatlng = new google.maps.LatLng(42.3726399, -71.1096528); var mapOptions = { zoom: 14, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP };

```
    var map = new google.maps.Map(
        document.getElementById('map_canvas'),
        mapOptions);

    var bikeLayer = new google.maps.BicyclingLayer();
    bikeLayer.setMap(map);
  }
</script>

```

[/code]
