kartena / Proj4Leaflet

Smooth Proj4js integration with Leaflet.
http://kartena.github.io/Proj4Leaflet/
BSD 2-Clause "Simplified" License
590 stars 173 forks source link

Uncaught TypeError #138

Closed Dizzzlectic closed 7 years ago

Dizzzlectic commented 7 years ago

Hello!

I have a Map service I'm subscribing to from an ESRI partner where I also have to convert it using CRS. I have a few layers added to the map as well and they occasionally seem to not be synchronized when zooming. I started by checking the Chrome developer console and I'm actually getting spammed with uncaught TypeErrors.

Setup: Leaflet v1.0.3 Leaflet Marker Cluster v1.0.3 Proj4Leaflet v1.0.1

My code and console log: gomap.no-1489143881626.txt code.txt

Is this something that's caused by me or it it something wrong with the map service/proj4leaflet? I've tried researching a bit but I'm coming up empty handed. It doesn't happen all too often, but often enough to notice it.

perliedman commented 7 years ago

From the looks of it, you, or some code you're using is passing a null reference where a L.LatLng is expected.

I suggest you use devtools in your browser to catch when this error occurs, and trace back to which function is passing along the null.

Dizzzlectic commented 7 years ago

Hmm, I'm only using Leaflet, proj4, proj4leaflet, esri-leaflet loaded in that order. (I do also have leaflet-markercluster, but this happened before I started using that plugin.)

All the JavaScript I'm using across my site is literally contained within code.txt attached on the previous post. I'll try and see what I can do about tracing it.

perliedman commented 7 years ago

Please either put a running example of the issue somewhere (like http://playground-leaflet.rhcloud.com/ or https://jsfiddle.net/), or step through it yourself.

Dizzzlectic commented 7 years ago

@perliedman Long day?

I thought I had a section with live preview and description in the OP, must have deleted it together with my original intention of posting the code I'm using directly;

If you navigate to http://gomap.no/scooter.php (it's a simple HTML page, don't be fooled.) and start zooming in/out with your mousewheel or something similar, specially before the data loaded from ESRI (the blue tracks) with the console open, you'll be able to reproduce the issue rather quickly.

perliedman commented 7 years ago

Sorry, can't reproduce in either Chrome 56 or Firefox 52 on Ubuntu. Reloaded and zoomed as quick as I could like ten times.

Dizzzlectic commented 7 years ago

For some reason I'm not able to reproduce it right now as well. I was easily able to reproduce it before the weekend within a few tries (using same Chrome version). I'll see if I can't come up with aproper series steps to accurately reproduce the issue every time.