Geovation / labelgun

🏷️ reducing label clutter across mapping libraries
https://geovation.github.io/labelgun/
113 stars 10 forks source link

TypeError: layer.getTooltip(...) is undefined #34

Closed tomchadwin closed 5 years ago

tomchadwin commented 5 years ago

I'm getting this error:

TypeError: layer.getTooltip(...) is undefined
    addLabel file:///C:/Users/tchadwin/Desktop/é/qgis2web_2019_06_17-15_11_29_065534/js/labels.js:29
    resetLabels file:///C:/Users/tchadwin/Desktop/é/qgis2web_2019_06_17-15_11_29_065534/js/labels.js:20
    eachLayer file:///C:/Users/tchadwin/Desktop/é/qgis2web_2019_06_17-15_11_29_065534/js/leaflet.js:5```

Relevant line is:

```javascript
  // This is ugly but there is no getContainer method on the tooltip :(
  var label = layer.getTooltip()._source._tooltip._container;

This implementation was taken from the labelgun Leaflet examples.

I'm assuming this must have occurred with a Leaflet version upgrade, but other than that, I'm in the dark at the moment.

tomchadwin commented 5 years ago

Urgh. User error. Issue only occurs when layer has no tooltips. Apologies.