Class HeatmapSurface


  • public class HeatmapSurface
    extends Object
    Computes a Heat Map surface from a set of irregular data points, each containing a positive height value. The nature of the surface is determined by a kernelRadius value, which indicates how far out each data points "spreads".

    The Heatmap surface is computed as a grid (raster) of values representing the surface. For stability, the compute grid is expanded by the kernel radius on all four sides. This avoids "edge effects" from distorting the surface within the requested envelope.

    The values in the output surface are normalized to lie in the range [0, 1].

    Author:
    Martin Davis, OpenGeo
    • Constructor Detail

      • HeatmapSurface

        public HeatmapSurface​(int kernelRadius,
                              Envelope srcEnv,
                              int xSize,
                              int ySize)
        Creates a new heatmap surface.
        Parameters:
        kernelRadius - the kernel radius, in grid units
        srcEnv - the envelope defining the data space
        xSize - the width of the output grid
        ySize - the height of the output grid
    • Method Detail

      • addPoint

        public void addPoint​(double x,
                             double y,
                             double value)
        Adds a new data point to the surface. Data points can be coincident.
        Parameters:
        x - the X ordinate of the point
        y - the Y ordinate of the point
        value - the data value of the point
      • computeSurface

        public float[][] computeSurface()
        Computes a grid representing the heatmap surface. The grid is structured as an XY matrix, with (0,0) being the bottom left corner of the data space
        Returns:
        a grid representing the surface