For some reason, the feature.cluster property is not defined when the cluster "threshold" option is used. This makes the zoom to cluster code error out with the following error as the right checks aren't made:

Uncaught TypeError: Cannot read property 'length' of undefined 

Reproducible steps:

1) Create a map with the latest --dev version of openlayers
2) Enable the Cluster features behaviour and set a Distance and threshold
3) Enable Popup for features behaviour, tick Zoom to cluster (Not zoom to point).
4) Attempt to click a point for the popup.

Patch attached.

Members fund testing for the Drupal project. Drupal Association Learn more


acbramley’s picture

Much better patch. There's also bigger issues with this functionality that I have discovered, I will raise this as a separate issue though.

Status: Needs review » Needs work

The last submitted patch, openlayers-cluster-threshold-fix-2.patch, failed testing.

acbramley’s picture

Status: Needs work » Needs review
1.32 KB


chegor’s picture

zmove’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I confirm the issue and I confirm that the fix works.

Pol’s picture

Status: Reviewed & tested by the community » Fixed

Committed & pushed ! Thanks for your patch and testing all !

Status: Fixed » Closed (fixed)

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