Closed runtimeavl closed 4 years ago
Hi there. Can you provide any working example (jsfiddle or any other) that I can take a look?
Dear Igor,
@Igor-Vladyka Thank you for your plugin. It is very nice. I encounter the similar issue like @runtimeavl, but I have over 6000 markers. I can provide you more information and I hope this problem can be solved.
For auto print or custom select print, except I zoom in a lot and only a few unclustered markers shown on screen, otherwise, it will have error messages below when the screen displays ClusterGroup and stop popup printing windows dialog.
In Firefox, the error message is too much recursion leaflet.browser.print.js line 127 > eval:14:1
In Chrome, the error message is
leaflet.browser.print.utils.js:159 Uncaught RangeError: Maximum call stack size exceeded
at Function.[Symbol.hasInstance] (
Thank you.
Dear Igor,
@Igor-Vladyka I have created a jsfuddle https://jsfiddle.net/curtis18/gLd2m3ab/ that is based on the example of markercluster https://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html and combined it with browser print. Thank you.
Hello, just fixed it in latest v0.9.2. Please take a look. Here is working fiddle: https://jsfiddle.net/8ce3bx9w/
@Igor-Vladyka Thank you very much for your fix. The issue basically has been solved. But I found that the performance and memory usage has problem when I have over 6000 markers on the map. Even when I select a small area to print, it will be either browser freezing and wait a lot of time for printing or out of memory and crash. Please help. Thank you.
Zoom in and select a small area
Browser Freeze
Out of memory
Hi guys,
Released new version of the plugin, with a MarkerClusterGroup registration moved out of the plugin. You will need to add your own registration/copy-paste it from documentation to make it work with latest.
Regards, Igor
@Igor-Vladyka Thanks a lot. I am going to update it according to the documentation.
Hi there,
Here is a bit dirty hack how to make it work without outofmemory exceptions:
// We are not cloning markercluster to preserve original clasterization behavior and prevent OutOfMemory problems
L.Control.BrowserPrint.Utils.registerLayer(L.MarkerClusterGroup, 'L.MarkerClusterGroup', function (layer, utils) {
return layer;
});
// On print end we invalidate markercluster to update markers;
map.on(L.Control.BrowserPrint.Event.PrintEnd, function(e) {
map.removeLayer(markers);
map.addLayer(markers);
});
Regards, Igor
@Igor-Vladyka Thanks for your great help.
How do I set the same zoom that is on my base map when printing? I don't want the MarkerCluster expands when i print the map
Dear Igor, I would like your help with the following: I have a markerClusterGroup with almost 500 markers, when I zoom in and marker.ClusterGroup shows many markes, browser.print works ok, but when zoomed out and marker.ClusterGroup shows only a few or no markers, browser.print throws me an error: too much recursion.
What am I doing wring? Please advice