I try to change the GeoTools HeatmapProcess.java and HeatmapSurface.java classes (https://github.com/geotools/geotools/tree/master/modules/unsupported/process-feature/src/main/java/org/geotools/process/vector), so that the resulting Heatmap can be displayed as a tiled WMS request without the cut off edges:
Anybody has an hint, what I have to change in the code to enable this?
My idea was the problem lies in the coordinate -> grid transformation to calculate the kernel density grid. I tried to increase the buffer radius of the grid calculation for each tile so that all points are included which are within the Kernel Density radius.
So far I tried to change the HeatmapSurface.java class by increasing the grid size by 100, increase the point offset by 50 and extract the grid respectively just for testing purposes but it doesn't have the intended effect:
private void init() {
gridTrans = new GridTransform(srcEnv, xSize, ySize);
gridTrans.setClamp(false);
gridTrans2.setClamp(false);
int xSizeExp = (xSize + 2 * kernelRadiusGrid) + 100;
int ySizeExp = (ySize + 2 * kernelRadiusGrid) + 100;
grid = new float[xSizeExp][ySizeExp];
}
public void addPoint(double x, double y, double value)
{
int gi = gridTrans.i(x) + kernelRadiusGrid + 50;
int gj = gridTrans.j(y) + kernelRadiusGrid + 50;
if (gi < 0 || gi > grid.length || gj < 0 || gj > grid[0].length)
return;
grid[gi][gj] += value;
public float[][] computeSurface() {
computeHeatmap(grid, kernelRadiusGrid);
float[][] gridOut = extractGrid(grid, kernelRadiusGrid + 50, kernelRadiusGrid + 50, xSize, ySize);
return gridOut;
}