shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
725 stars 288 forks source link

Google BicyclingLayer #204

Closed smitchell closed 7 years ago

smitchell commented 8 years ago

Do you have a way to support the Google Bicycling Layer? https://developers.google.com/maps/documentation/javascript/examples/layer-bicycling

If not is there a way to get a handle to the google.maps.Map from Google.js in order to do this?

  var bikeLayer = new google.maps.BicyclingLayer();
  bikeLayer.setMap(map);

The map that I am hoping to replace with Leaflet allows the user to toggle the Bicycle Layer on and off. When a runner is drawing a route she might want to toggle trails on in order to get directions that route over a running/biking trail. Other users might feel that the Bicycle Layer clutters the map opt to turn it off.

I tried to find _google at run time in order to add the bike layer myself, but I didn't find it in the debugger.

Note, we also use the same option for Bing maps (although their trail networks is much less extensive).

brunob commented 8 years ago

Sorry but i don't know, i'm putting the minimum effort on google script since it's quite buggy and we still doesn't know if it's really compliant with google tos. Anyway, feel free to provide a PR for that :)

smitchell commented 8 years ago

Okay, I submitted an inquiry to our contracts person yesterday. If I get the green light I will be happy to contribute anyway that I can.

brunob commented 8 years ago

@rcknr thx for the feedback, feel free to post your comment on #48 :)

rcknr commented 8 years ago

@brunob yeah, just saw there's a bigger discussion.

rcknr commented 8 years ago

@smitchell You can add bicycling layer like this:

var googleLayer = new L.Google('ROADMAP');
map.addLayer(googleLayer);

var bikeLayer = new google.maps.BicyclingLayer();
bikeLayer.setMap(googleLayer._google);
brunob commented 8 years ago

@rcknr thx for helping @smitchell can we close this issue now ?

brunob commented 7 years ago

We can finally close this one since #250 :)