Great module, thank you - very useful. I wanted to ask if there is a way to disable clustering on some maps. At the moment it turns itself on for all maps but not all maps need it in my use case. Any advice would be appreciated.

Comments

simon georges’s picture

Category: support » feature
rdeboer’s picture

When you use Leaflet MarkerCluster in combination with IP Geolocation Views and Maps you can switch it on/off per map and also specify the cluster radius per map.
Rik

simon georges’s picture

@RdeBoer, would you mind deporting this functionality here, then?
In my opinion, IP Geolocation Views and Maps should be a kind of "glue" module that puts everything together, but each module should be responsible for its functionality and settings, don't you think?

rdeboer’s picture

@Simon Georges,

I see what your saying.

The way Leaflet MarkerCluster is designed at the moment is more like a lighweight plugin than a fully-fledged, bells-and-whistles kind of spaceship.

Peter Vanhee (pvhee) is the author and head maintainer of Leaflet MarkerCluster and I'll leave it up to him to decide in which direction he wants to go with the module.

Rik

el1_1el’s picture

I had this issue with markercluster, leaflet_views and geofield. I "solved" it by adding an element to the form in leaflet/leaflet_views/leaflet_views_plugin_style.inc

    $form['use_clusters'] = array(
      '#title' => t('Use Clustering'),
      '#type' => 'checkbox',
      '#description' => t('Use the Leaflet Marker Cluster module.'),
      '#default_value' => isset($this->options['use_clusters']) ? $this->options['use_clusters'] : TRUE
    );

and then a hook in leaflet_markercluster.module

function leaflet_markercluster_views_post_execute(&$view) {
if($view->query->pager->display->handler->view->display['default']->handler->options['style_options']['use_clusters']==1){
	  drupal_add_js(drupal_get_path('module', 'leaflet_markercluster') . '/leaflet_markercluster.drupal.js');
}
}

I'm pretty sure there's a better (proper) way to do this that doesn't span 2 modules and gets the use_clusters checkbox without digging 12 levels into the $view object, so I wont post a patch and will hope someone enlightens me on how to do this correctly...but in the meantime, this seems to solve the problem

el1_1el’s picture

Also, this seems to be a duplicate of (or at least related to) these issues - https://drupal.org/node/1845356
https://drupal.org/node/2038659

el1_1el’s picture

I rewrote this as patches after the recent security upgrade broke my last fix. I still need to find a way to port the patch on leaflet/leaflet.formatters.inc into the leaflet_markercluster module. Definitely not the ideal solution but seems to be working so far and might get a ball rolling... anyone else interested?

rdeboer’s picture

Status: Active » Closed (outdated)

Use IPGV&M.

sano’s picture

The patches @el1_1el provided helped me to realize that clustering can be turned off also by creating a module with map definition that includes

'maxClusterRadius' => 0

... in the map settings array.

By the way, on different pages I use also IPGV&M where clustering can indeed be toggled on/off, but that module does not allow me to dynamically style (say: color) points rendered in the map from row values.