I'm applying PointStacker transformation on one of my layers using Geoserver 2.5.2 and OpenLayers 2.

I know, that I have 7 datapoints located on the exact same location. However, when I change the zoom level the stacked point is moving around randomly. I would've thought that the stacked point's location is calculated by the mean of the vector points being stacked. In other words, if they are located at the same location, it shouldn't move around changing zoom levels.

What am i doing wrong?

zoom level 7: zoom level 7

zoom level 8: enter image description here

zoom level 9: enter image description here

zoom level 10: enter image description here

zoom level 11: enter image description here

  • It is an OpenLayers 2 problem with marker display. Every marker I tried to use jumped randomly in different zoom levels. I don't know if because of this, but the marker function got deprecated in OpenLayers 3. Commented Sep 28, 2014 at 12:23
  • I'm using geoserver as WMS source, meaning no markers are placed on the map via javascript/OpenLayers. All markers get rendered on geoserver side. OpenLayers is just requesting the map tiles from geoserver and Google maps. In this aspect I do believe something is fishy on geoserver side.
    – SandorRacz
    Commented Sep 28, 2014 at 12:34
  • Just checked with OpenLayers3, the same issue exist.
    – SandorRacz
    Commented Sep 28, 2014 at 14:16
  • I looked up GeoServer's manual for the Point Stacker function. It didn't say anything about clustered point placement. Maybe it is an issue coming from coordinate rounding in different scales, but it's just an assumption. One thing sure, this isn't a native problem in GeoServer, since OL2 is doing this, too with markers. Commented Sep 29, 2014 at 12:05
  • If you set the isFixed property of your vector layer to true, the problem still persists? Commented Sep 30, 2014 at 10:47

2 Answers 2


Your assumption about how PointStacker calculates the cluster point's location is incorrect. It doesn't use centre of mass in the way you'd expect.

The bounds of the images request are broken up into a grid and clusters are created for each cell of that grid. So if you have what looks to you like a natural cluster, e.g. 3 points close to each other, they will only be clustered together if all 3 are in the same grid cell. If they fall into 3 grid cells they will be assigned to 3 separate clusters.

As you zoom in the points do not land in the same grid cell as in the previous image and therefore the cluster is given a new location relative to the image's width and height.

This is not the most intuitive behaviour but it does make for a much simpler clustering algorithm. You can see the code here: https://github.com/geotools/geotools/blob/master/modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java


I believe that this is caused by the cellSize parameter.

If you set this parameter to 1 (the locations you want to aggregate are exactly the same then the marker should be displayed at that location.

If you increase the cellSize the marker will be placed somewhat randomly inside a buffer defined by the cellSize in pixel.

<ogc:Function name="parameter">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.