Google Layer doesn't work with Leaflet 1.0.0 Beta
See original GitHub issueHi all,
I’m creating a map and i’m trying to add a tile layer with Leaflet 1.0.0 Beta, this is my code:
var myCenter = new L.LatLng(50.5, 30.51);
var map = new L.Map('map', {center: myCenter, zoom: 15});
var positron = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {});
map.addLayer(positron);
It works perfectly, but when i try to add a Google Layer with Leaflet Google library(http://matchingnotes.com/javascripts/leaflet-google.js) doesn’t work:
var map = new L.Map('map', {center: myCenter, zoom: 15});
var ggl = new L.Google();
map.addLayer(ggl);
after that i tried to change the version of Leaflet to 0.7.5 and worked perfectly. I need to use Leaflet 1.0.0 Beta because of some features so i can’t just change the version on my project.
Check an example in: http://jsbin.com/nafoloxade/edit?html,console,output
Please could you help me with this?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Can't get dashArray to work on canvas in Leaflet 1.0.3
The documentation says "Doesn't work on Canvas-powered layers in some old browsers.", but this happens in the very latest Chrome.
Read more >leaflet.gridlayer.googlemutant - npm
A plugin for LeafletJS to use Google maps basemaps. ... This plugin doesn't work on IE10 or lower, as that browser doesn't implement...
Read more >Plugins - Leaflet - a JavaScript library for interactive maps
Non-map base layers. Sometimes you don't want to load a map, just big custom images. Really big ones. Plugin ...
Read more >Leaflet error: h.fn is undefined when using layer.on('loading ...
The problem was that I was trying to listen to the loading event which in this case makes not much sense, I can...
Read more >leaflet - UNPKG
The CDN for leaflet. ... 48, The problem with Google is that its [Terms of ... 50, You can add the Google Maps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
SOLVED: download and replace file Google.js
https://raw.githubusercontent.com/shramov/leaflet-plugins/leaflet_one/layer/tile/Google.js
https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant