Recently I had to implements features that might face multiple Leaflet maps (fit bounds), interactions from outside of the map & View AJAX calls .
I succeeded in all this, as you can see in this project page: http://www.italomairo.com/geoblogcms/en/ip-locations-leaflet
that strongly use the Leaflet and Leaflet markeclusters and IP Geolocation Views & Maps modules.

But for make all this properly working had to hack and fit the leaflet and leaflet markeclusters javascript files.

Here attached is the diff file for the leaflet.drupal.js I use now, properly commented in the added/amended code lines.

All this is strictly related to (and fix) other issues like:
https://drupal.org/node/2040627
https://drupal.org/node/2005328
(and probably also this …) https://drupal.org/node/2048805

Last, but not least, this issue is the correspondent of its analogue in the Leaflet Module (https://drupal.org/node/2056557)

Comments

itamair’s picture

Issue summary: View changes

xxx

itamair’s picture

Issue summary: View changes

xxx

itamair’s picture

Issue summary: View changes

xxx

mgifford’s picture

Adding link to duplicate issue which was closed in favour of this one #2048805: Incorrect centering when displaying multiple Leaflet maps on the same page

osopolar’s picture

StatusFileSize
new4.7 KB
+++ b/sites/all/modules/leaflet/leaflet.drupal.js
@@ -4,6 +4,14 @@
+        if (L.DomUtil.get(this.mapId)) {

Isn't this already checked by the next control sequence: if (!container || container._leaflet) or what is the difference?

I tried to short some comments and fixed coding standards (whitespaces and comment style). I can't say much about the other changes. Would be nice if somebody with deeper knowledge would review them.

Finally, it is working. At least all the different maps in the view seems to be centered correctly: Each map has just one marker, which is now in the middle of each map. Before the markers beside the first map where not visible.

osopolar’s picture

Status: Active » Needs review
osopolar’s picture

Issue summary: View changes

xxx

gdana’s picture

Hi,

just thought I'd point out that this patch seems to be working for me, solving issues I had where filtering didn't center the maps to the results when Ajax was turned on (similar to the problem described in #2118531: Re- center map with ajax in views).

After applying the patch the centering and zooming started working correctly just like when filtering and submitting without Ajax.

Thanks a lot, will it be committed to the module at some point?

dasjo’s picture

#2 doesn't apply for me and unfortunately i couldn't understand the approach being taken.

i have added an related patch at #2048805: Incorrect centering when displaying multiple Leaflet maps on the same page because i think the other issue title is more appropriate.

levelos’s picture

Issue summary: View changes
Status: Needs review » Closed (duplicate)