openlayers icon indicating copy to clipboard operation
openlayers copied to clipboard

WebGLVectorLayer point with cluster

Open fjacupar opened this issue 5 months ago • 4 comments

Hello,

I haven't seen it in the examples, but I wanted to confirm with you that it is possible to create a WebGLVectorLayer point with a cluster and assign it a style function to generate different cluster styles depending on cluster size.

Thanks in advance,

fjacupar avatar Jul 28 '25 16:07 fjacupar

A ol/source/Cluster is just a ol/Source/Vector with Point features that are generated on the fly. Though the style has to be https://openlayers.org/en/latest/apidoc/module-ol_style_flat.html#~FlatStyleLike for ol/layer/WebGLVector and text rendering is not implemented yet. https://github.com/openlayers/openlayers/blob/86ab34ac2469323e822ee51c7db9042b1da3a6e6/src/ol/layer/WebGLVector.js#L35

M393 avatar Jul 28 '25 17:07 M393

Thanks for your quick response @M393. OK, so I could apply different styles depending on cluster size, but text rendering is not possible. Do you know if there are plans to implement it anytime soon?

fjacupar avatar Jul 28 '25 20:07 fjacupar

https://github.com/openlayers/openlayers/pull/16693#issuecomment-3000682880

M393 avatar Jul 29 '25 08:07 M393

@M393 perfect thank you.

fjacupar avatar Jul 30 '25 11:07 fjacupar