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.

esri-leaflet fails when calling fitbounds

See original GitHub issue
  • Browser and version: Chrome latest

  • Version of Leaflet (L.version): 1.3.0

  • Version of esri Leaflet (L.esri.VERSION): 2.1.4

Steps to reproduce the error: It’s hard to say, since I couldn’t create a minimal reproduction, but it has to do with fitbounds method called when the zoom level is already set to the same zoom.

What happens is [X]. I get an ugly error message I was expecting [Y]. No error message should appear

Here is the error message:

TypeError: Cannot read property 'min' of undefined
    at NewClass._isValidCell (esri-leaflet-debug.js:3028)
    at NewClass._addCells (esri-leaflet-debug.js:2997)
    at NewClass._update (esri-leaflet-debug.js:2980)
    at (leaflet-src.js:593)
    at NewClass.panBy (leaflet-src.js:3276)
    at NewClass._tryAnimatedPan (leaflet-src.js:4500)
    at NewClass.setView (leaflet-src.js:3154)
    at NewClass.fitBounds (leaflet-src.js:3253)
    at DataContainerService.push../sources/application/services/data-container.service.ts.DataContainerService.setData (data-container.service.ts:45)
    at DataContainerService.<anonymous> (data-container.service.ts:97)

Here’s a screenshot of the debug I tried, but I’m clueless to what should be the right values, maybe you guys can look at it and let me know if you need more info, I have no problem reproducing it. image

I can probably also upload a beta site with the source maps if you’d like to debug it yourself. The layers are extremely valuable to my users but I can’t have my site crashing on a third party plug-in…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

Braedennzcommented, Sep 21, 2020

This issue still persists, is there a solution for this error?

HarelMcommented, Jul 2, 2018

I can confirm the following code seems to solve the issue:

_isValidCell: function (coords) {
    var crs =;

    if (!crs.infinite) {
      // don't load cell if it's out of bounds and not wrapped
      var cellNumBounds = this._cellNumBounds;
      if (!cellNumBounds) { // you can probably check for null or undefined.
           return false;
      if (
        (!crs.wrapLng && (coords.x < cellNumBounds.min.x || coords.x > cellNumBounds.max.x)) ||
        (!crs.wrapLat && (coords.y < cellNumBounds.min.y || coords.y > cellNumBounds.max.y))
      ) {
        return false;
Read more comments on GitHub >

github_iconTop Results From Across the Web

LEAFLET + map.fitBounds - Stack Overflow
I'm trying to make the map zoom in by clicking on the point. but for some reason I'm having the error "× Error:...
Read more >
leaflet - How to fit bounds after adding multiple markers
You can instantiate a LatLngBounds object and then extend() it with the coordinates of the companies. After adding the markers you can call...
Read more >
L.esri.Query | Esri Leaflet - ArcGIS Developers
It provides a chainable API for building request parameters and executing queries. Note Depending on the type of service you are querying (Feature...
Read more >
Solved: use variable for distance in esri leaflet nearby?...
Solved: Hello: How can I use a variable when using the nearby method on a query layer so the user can select the...
Read more >
'ESRI' Bindings for the 'leaflet' Package
group. The name of the group this layer should be added to. Examples. popupFunc <- htmlwidgets::JS(. "function (error, featureCollection) { if ( ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found