question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google Layer doesn't work with Leaflet 1.0.0 Beta

See original GitHub issue

Hi 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:closed
  • Created 8 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found