After enable Leaflet Markercluster module i have an error "Uncaught TypeError: Object [object Object] has no method 'getLatLng' " at line 584 and no markers showing.
JS code at this line:

//Find the lowest zoom level to slot this one in
		for (; zoom >= 0; zoom--) {
			markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position

Comments

rdeboer’s picture

Tell us a bit more about your set up.
E.g.:
Are you using Leaflet to display the output of a standard View or is it something home-grown?
What map? OSM Mapnik?
Simple markers or other geometric features?

okolobaxa’s picture

Thx for replay!
Additional circumstances opened!
I make standart view with geofields and 15 simple markers: http://oldsaratov.ru/simplemap - it works nice, all ok.
I have another very big map http://oldsaratov.ru/simplemapfull with ~4500-5000 markers ( http://oldsaratov.ru/simplemapfull ) and in this configuration I have an error, described in issue. Maps differ only by number of markers.

Maybe markers loaded via AJAX and drupal goes down when try to load big а array of data?

rdeboer’s picture

Yes that could be the issue.
5000 is a large number of markers....
Using a Views filter can you try and reduce the set to see if there is a smaller number of markers where the map starts to work again?

okolobaxa’s picture

Up to ~4000-4200 markers shows normal

rdeboer’s picture

When it fails, is it always the same error?
Do you have anything in the marker balloons?

okolobaxa’s picture

Yes, always same error on 4300 and more markers.
Yes, in ballons i put node title.

rdeboer’s picture

Cool, thanks.
I'm wondering whether the data gets truncated over a certain amount....
So, if you could NOT have the title in the balloon for a while,are you then able to increase the number of markers successfully displayed?
Another, unlikely, possibility is that there are illegal characters in the 4301st node title....

okolobaxa’s picture

No node title manipulation does not increase the number of visible markers.
4300 is approximate value. It may be 4250, 4265, 4350, etc. I still think that the problem is in performance. If site has more load, it downs with fewer markers.

rdeboer’s picture

You could be right.

I was wondering whether the browser is a factor... Don't forget that all this marker data resides in the source of the page that has the map on it (just use View->Page source on your browser and you can see them).

And the maps are generated through javascript running in your browser, with the "tiles" that make up the map retrieved from the Internet (not the Drupal server), also by the browser. So once the server has transferred the javascript code plus the markers to the client browser, the server has little to do with the rendering of the map on your screen.

Would be interesting to see if changing the browser changes the number of markers that can be viewed on a single map...

iaminawe’s picture

I am receiving a similar issue with this using the latest dev of leaflet and leaflet_markercluster.

I get this error in my console

Uncaught TypeError: Object #

has no method 'point' relating to this line of code lFeature.bindPopup(feature.popup, {autoPanPadding: L.point(25,25)}); I am using a straight osm map, around 200 points and it works fine with the the leaflet_cluster module disabled but as soon as its enabled all I get is a grey square instead of the map and the error above in my console log. Any ideas as to how I can get around this? Thanks
rdeboer’s picture

Title: Uncaught TypeError: Object [object Object] has no method 'getLatLng' » Uncaught TypeError: Object [object Object] has no method 'getLatLng' (4300 markers)
Issue summary: View changes
rdeboer’s picture

Re #10. Try Leaflet 7.x-1.1 and Leaflet MarkerCluster 7.x-1.x-dev.

rdeboer’s picture

Status: Active » Closed (outdated)