tf_geo_rasterize_slope
Similar to tf_geo_rasterize
, but also computes the slope and aspect per output bin.
Aggregates point data into x/y bins of a given size in meters to form a dense spatial grid, computing the specified aggregate (using agg_type
) across all points in each bin as the output value for the bin. A Gaussian average is then taken over the neighboring bins, with the number of bins specified by neighborhood_fill_radius
, optionally only filling in null-valued bins if fill_only_nulls
is set to true. The slope and aspect is then computed for every bin, based on the z values of that bin and its neighboring bins. The slope can be returned in degrees or as a fraction between 0 and 1, depending on the boolean argument to compute_slope_in_degrees
.
Note that 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_slope
table function, these filters will also constrain the output range.
Input Arguments
x
Input x-coordinate column or expression.
Column<FLOAT | DOUBLE>
y
Input y-coordinate column or expression.
Column<FLOAT | DOUBLE>
z
Input 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
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.
BIGINT
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
compute_slope_in_degrees
If true, specifies the slope should be computed in degrees (with 0 degrees perfectly flat and 90 degrees perfectly vertical). If false, specifies the slope should be computed as a fraction from 0 (flat) to 1 (vertical). In a future release, we are planning to move the default output to percentage slope.
BOOLEAN
Output Columns
x
The x-coordinates for the centroids of the output spatial bins.
Column<FLOAT | DOUBLE> (same as input x column/expression)
y
The y-coordinates for the centroids of the output spatial bins.
Column<FLOAT | DOUBLE> (same as input y column/expression)
z
The maximum z-coordinate of all input data assigned to a given spatial bin.
Column<FLOAT | DOUBLE> (same as input z column/expression)
slope
The average slope of an output grid cell (in degrees or a fraction between 0 and 1, depending on the argument to compute_slope_in_degrees
).
Column<FLOAT | DOUBLE> (same as input z column/expression)
aspect
The direction from 0 to 360 degrees pointing towards the maximum downhill gradient, with 0 degrees being due north and moving clockwise from N (0°) -> NE (45°) -> E (90°) -> SE (135°) -> S (180°) -> SW (225°) -> W (270°) -> NW (315°).
Column<FLOAT | DOUBLE> (same as input z column/expression)
Example
Last updated