When using the Grouping field, clustering doesn't work. Disabling the grouping field allows clustering to work again.

Also, how do you assign a custom image to the cluster feature? I want to give it a specific image, rather than the default orange circle...

Comments

phayes’s picture

Version: 6.x-2.x-dev » 6.x-1.0-beta2

This is a bug in the clustering behavior, not the view. For anyone wishing to take on this bug, here is an example of it not working:


$preset = openlayers_get_preset('default');
$map = $preset['preset_data'];

$map['behaviors'] = array (
  'clusterone' => array (
    'id' => 'clusterone',
    'type' => 'openlayers_behaviors_cluster',
    'layer' => 'default_vector',
  ),
  'clustertwo' => array (
    'id' => 'clustertwo',
    'type' => 'openlayers_behaviors_cluster',
    'layer' => 'second_vector',
  ),
'fullscreen' => array (
    'id' => 'fullscreen',
    'type' => 'openlayers_behaviors_fullscreen',
  ),
);

$map['layers']['default_vector'] = array (
          'id' => 'default_vector',
          'type' => 'Vector',
          'name' => t('Default Vector'),
          'options' => array(),
          'features' => array(
            'yeah' => array(
              'wkt' => 'POINT(-55 55)',
              'projection' => '4326',
            ),
            'yeah2' => array(
              'wkt' => 'POINT(-50 50)',
              'projection' => '4326',
            ),
          ), 
        );

$map['layers']['second_vector'] = array (
          'id' => 'second_vector',
          'type' => 'Vector',
          'name' => t('second Vector'),
          'options' => array(),
          'features' => array(
            'yeah3' => array(
              'wkt' => 'POINT(55 -55)',
              'projection' => '4326',
            ),
            'yeah4' => array(
              'wkt' => 'POINT(50 -50)',
              'projection' => '4326',
            ),
          ), 
        );


$map = openlayers_render_map($map);

print $map['themed'];

phayes’s picture

Title: Grouping field prevents clustering » Cluster behavior does not work with two layers
Version: 6.x-1.0-beta2 » 6.x-2.x-dev
Component: OpenLayers Views » OpenLayers Behaviors

updating version...

phayes’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev

crap. updated to wrong version... updating to correct version.

zzolo’s picture

Status: Active » Fixed

http://drupal.org/cvs?commit=297066

I changed around the clustering logic pretty significantly. Before it was taking options from the behavior array and pushing them into the top level map options. Then it would create a cluster object for the vector layer based on those. I am not actually even sure if it was working.

Now, it is all based on layers (and should be only for Vector layers). So, a behavior is defined as a cluster with a layer defined. Then when Vector layers are made, they look for corresponding cluster behaviors.

This seems to be working fine with the test example I coded into the test module. But more testing would be great. Also, please note that this may break anyone currently using clustering.

As far as 2.x, I don't feel this is a very elegant solution, and I am not sure what is in the 2.x code as far as clusters, so I don't think there is any reason to port this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

agileware’s picture

Component: OpenLayers Behaviors » OpenLayers API
Status: Closed (fixed) » Active

I have a WMS map with three layers grouped by a cck field and if I turn on the clusterer for the view
my template overridden colours are lost and popups don't work anymore.

As soon as I disable cluster it works again.

This is fine as I don't need it but I just wanted to report it.

This happens even with the current dev version.

agileware’s picture

Component: OpenLayers API » Behaviors

Changing component back

agileware’s picture

Actually I've resolved the popup issue I was having.

The colours thing is kind of a different issue to the one committed but the original poster also asked about it.

I can open a different issue for that if you like.

zzolo’s picture

@agileware, if you are still having a problem and it is unrelated to this specific issue, then it would be cool if you started a new ticket. Thanks.

agileware’s picture

Status: Active » Closed (fixed)

No worries

dasjo’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Closed (fixed) » Active

i am not shure if this matches the issue, but i am trying to cluster multiple layers. so that points of different layers could be clustered together. it doesn't seem to work and i suppose this is yet by design. could this be confirmed?

strk’s picture

@dasjo clustering is per-layer by design. Doesn't match the issue.

dasjo’s picture

thanks strk, resetting this issue and opened a support request: #930864: clustering across multiple layers

dasjo’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Status: Active » Closed (fixed)