I've been trying the GeoServer Rendering Transformations - Point Stacker. According to this docs there's an optional cellSize
parameter for setting the "Size of the cells in which to aggregate points, in pixels, default = 1".
I made the SLD based on the SLD example in the above OpenGeo docs.
I tried 2 cellSize
(30 and 150). Here are the results:
Figure 1. GeoServer cluster (using Point Stacker) : there's displacement
Blue squares are points (exact, not clustered). Orange circles are clusters. Both layers (blue squares & orange circles) are WMS.
There are 41 points in the island.
The Graphic circles (defined in SLD as <PointSymbolizer>
) seems to be positioned incorrectly. The above pictures show that displacement grow with cellSize
parameter.
Why does this happen?
I saw PointStacker - Random locations at different zoom level asking about random position of Point Stacker, but no solid answer so far.
The below picture shows the same points (of another area). Again the blue squares are points (exact, not clustered) & orange circles are clusters.
Figure 2. GeoServer cluster (using Point Stacker) : there's displacement
Now because the zoom level is very high (more zoom-in than previous picture), the 4 points are not clustered. Ideally the orange points should be rendered in exact position as the blue point layer. But apparently GeoServer renders the orange points with some displacement. This is also asked in this question.
This picture also shows that displacement grow with cellSize
parameter. Interesting enough that the displacements seem to be random.
Now let us see OpenLayers cluster. In contrast with GeoServer Point Stacker cluster (shown in Figure 1 above), OpenLayers cluster doesn't seem to have displacement. Here it is:
Figure 3. OpenLayers Cluster: no displacement
In the above figure, OpenLayers clusters GeoJSON vector points coming from GeoServer WFS. The right-side column is just the same with the left-side, only disabling the blue square for increasing visibility of the number label in OpenLayers clusters.
In the OpenLayers Cluster layer there's a circle with label "1" that is rendered in exact position as the blue square point, which I think is very make sense. To me, OpenLayers cluster is not perfect, but much-much better than GeoServer Point Stacker cluster (WMS).
Did I do anything wrong in my GeoServer Point Stacker cluster (WMS)?
- The reason I am pursuing GeoServer Point Stacker cluster (WMS) over OpenLayers Cluster (WFS) is because I feel insecure with WFS. Serving my map as WFS means that I am distributing it in the raw format (text) that can easily be stored and reconstructed into vector map by (smart) user.
I'm using:
- GeoServer 2.7.0 on Apache Tomcat 7.0.61 on Windows Server 2008 R2 Datacenter 64-bit on VMWare
- JVM: Oracle Corporation: 1.7.0_80 (Java HotSpot(TM) 64-Bit Server VM)
- OpenLayers 2.12
- PostGIS - PostgreSQL 9.4.1 (on Windows Server 2008 R2 Datacenter 64-bit on VMWare)
cellSize
does matter. But the real problem remains: GeoServer Rendering Transformations - Point Stacker renders cluster strangely. Any ideas?PreserveLocation
but I did not catch that. I added that in my SLD:<ogc:Function name="parameter"> <ogc:Literal>preserveLocation</ogc:Literal> <ogc:Literal>Superimposed</ogc:Literal> </ogc:Function>
. Where possible parameter are:Single
,Superimposed
, andNever
. Now the rendered WMS cluster map is -not perfect- but much better.