tf_geo_rasterize
Aggregate point data into x/y bins of a given size in meters to form a dense spatial grid, with taking the maximum z value across all points in each bin as the output value for the bin. The aggregate performed to compute the value for each bin is specified by agg_type
, with allowed aggregate types of AVG
, COUNT
, SUM
, MIN
, and MAX
. If neighborhood_fill_radius
is set greater than 0, a blur pass/kernel will be computed on top of the results according to the optionally-specified fill_agg_type
, with allowed types of GAUSS_AVG, BOX_AVG
, COUNT
, SUM
, MIN
, and MAX
(if not specified, defaults to GAUSS_AVG
, or a Gaussian-average kernel). if fill_only_nulls
is set to true, only null bins from the first aggregate step will have final output values computed from the blur pass, otherwise if false all values will be affected by the blur pass.
Note that the arguments to bound the spatial output grid (x_min, x_max, y_min, y_max) are optional, however either all or none of these arguments must be supplied. If the arguments are not supplied, the bounds of the spatial output grid will be bounded by the x/y range of the input query, and if SQL filters are applied on the output of the tf_geo_rasterize
table function, these filters will also constrain the output range.
Input Arguments
x
X-coordinate column or expression
Column<FLOAT | DOUBLE>
y
Y-coordinate column or expression
Column<FLOAT | DOUBLE>
z
Z-coordinate column or expression. The output bin is computed as the maximum z-value for all points falling in each bin.
Column<FLOAT | DOUBLE>
agg_type
The aggregate to be performed to compute the output z-column. Should be one of 'AVG'
, 'COUNT'
, 'SUM',
'MIN'
, or 'MAX'.
TEXT ENCODING NONE
fill_agg_type
(optional)
The aggregate to be performed when computing the blur pass on the output bins. Should be one of 'AVG'
, 'COUNT'
, 'SUM'
, 'MIN'
, 'MAX'
, ' 'AVG', 'COUNT', 'SUM',
'GAUSS_AVG'
, or 'BOX_AVG'
. Note that AVG
is synonymous with GAUSS_AVG
in this context, and the default fill_agg_type
if not specified is GAUSS_AVG
.
TEXT ENCODING NONE
bin_dim_meters
The width and height of each x/y bin in meters. If geographic_coords
is not set to true, the input x/y units are already assumed to be in meters.
DOUBLE
geographic_coords
If true, specifies that the input x/y coordinates are in lon/lat degrees. The function will then compute a mapping of degrees to meters based on the center coordinate between x_min/x_max and y_min/y_max.
BOOLEAN
neighborhood_fill_radius
The radius in bins to compute the box blur/filter over, such that each output bin will be the average value of all bins within neighborhood_fill_radius
bins.
DOUBLE
fill_only_nulls
Specifies that the box blur should only be used to provide output values for null output bins (i.e. bins that contained no data points or had only data points with null Z-values).
BOOLEAN
x_min
(optional)
Min x-coordinate value (in input units) for the spatial output grid.
DOUBLE
x_max
(optional)
Max x-coordinate value (in input units) for the spatial output grid.
DOUBLE
y_min
(optional)
Min y-coordinate value (in input units) for the spatial output grid.
DOUBLE
y_max
(optional)
Max y-coordinate value (in input units) for the spatial output grid.
DOUBLE
Output Columns
x
The x-coordinates for the centroids of the output spatial bins.
Column<FLOAT | DOUBLE> (same as input x-coordinate column/expression)
y
The y-coordinates for the centroids of the output spatial bins.
Column<FLOAT | DOUBLE> (same as input y-coordinate column/expression)
z
The maximum z-coordinate of all input data assigned to a given spatial bin.
Column<FLOAT | DOUBLE> (same as input z-coordinate column/expression)
Example