Jump to content
  • Users Guide to Voronoi Polygons for Spotfire® data function

    This article is a guide to using the Voronoi Polygons data function. This Data Function generates Voronoi polygons forming a tessellation that covers the study region. Polygons can be used as a feature layer on a map chart.

    Please download the Voronoi Polygons for Spotfire® from the exchange. 


    Details about the data function

    Description: From input point locations, create Voronoi polygons for Spotfire map visualization. Can produce one Voronoi polygon per input point, or polygons that summarize multiple points. Resulting polygons form a tesselation that covers the study region. Outline is determined either by convex hull or by optional separate boundary. Coordinates can be specified either as Cartesian (x,y) or Geographic (Longitude, Latitude) Result is an object that can be dragged directly from the Spotfire data panel onto a map visualization.

    R Packages used: stats, ggvoronoi, wkb, sp

    Note: The first time this script is run it will automatically attempt to install any of these required R packages that are not currently present in the user's environment. This is a one-time operation - therefore the first time the data function is executed, it may be slower than subsequent runs.


    • Required inputs
      • Xcoordinate (numeric vector): X coordinate (e.g. Longitude) of point location data
      • Ycoordinate (numeric vector): Y coordinate (e.g. Latitude) of point location data.
    • Optional Inputs
      • ReductionFactor (Doesn't have to be an integer)
        • Optional Reduction Factor for computing number of output polygons relative to number of input points.
        • Use e.g. 10 to have 10x fewer polygons than input points.
        • Default value = 1 meaning one polygon per input point.
        • If parameter Nclusters is specified, it will override ReductionFactor.
      • Nclusters (integer)
        • The number of clusters to use can be optionally set here.
        • This parameter overrides Reduction Factor.
        • Note that if an outline is specified some clusters may be eliminated
      • DataColumns (numeric table): Optional numeric data columns to aggregate.
      • agg.operation (string)
        • Optional string specifying aggregation operation.
        • Defaults to mean (average)
        • Choose "sum" or "mean". "avg" and "average" are also recognized.
      • XCoord.Outline (optional outline): x-coordinate (e.g. Longitude) of a contiguous polygon to use as an optional outer border (e.g. usa outline)
      • YCoord.Outline: y-coordinate (e.g. Latitude) of a contiguous polygon to use as an optional outer border (e.g. usa outline)
      • Bool.Geographic
        • Optional Boolean switch. True=use Geographic CRS; FALSE= use Cartesian
        • Default: Geographic (Longitude, Latitude)


    • Voronoi (data frame with shape geometry)
      • Table containing Voronoi shapefile.
      • Each row contains a single closed polygon (tile)
      • Each tile is identified by a tileID which matches the tileID returned in the IDcolumn
    • IDcolumn
      • Column named tileID that matches the original points, intended to return as a new column in the original data table.
      • Although the Voronoi table can be used as-is, this column is valuable in constructing visualizations that respond to live filtering.
    • groupCenters: Table that holds the labeled centroid locations of the Voronoi polygons


    There are two use cases; both cases assume you start with a data table containing coordinates (Longitude and Latitude or simply x and y) and one or more numeric columns.

    • Case 1: Aggregate numeric values to a single table. Results are ready to drag and drop onto a Spotfire map visualization, but they contain aggregated values only.
    • Case 2: Aggregate the locations only from the data table, producing a Voronoi table but also produce a new column for the input data, enabling Spotfire Column Matching between these tables. This column matching allows Spotfire filtering to update the Voronoi visualization so it is no longer static. Requires a couple more steps to set up the map visualization


    Case 1: Single aggregate data table: Best for overlaying point data

    In this example, geology data (porosity, permeability) are needed at some well locations (initial graypoints). The data is available at a series of separate locations (initial blue points).

    Voronoi polygons with averaged geology values are calculated for the region.   These average values from the polygons are then overlaid on top of the well locations to provide an estimate of porosity and permeability, where there was none before.


    Case 2: Separate tables enabling live filtering

    The Spotfire data table containing the Voronoi is kept separate from the underlying data.

    Spotfire filters can be applied to the underlying data, updating what is displayed in the Map chart.   Here the bands of precipitation moving across the US during the winter storm event of March 2019 (the "Bomb Cyclone') are made visible.


    More Resources

    • See the video on how to use this data function:

    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...