Process a raster input to derive contour lines or regions and output as LINESTRING or POLYGON for rendering or further processing. Each has two variants:
One that re-rasterizes the input points (rasterizing variant)
One which accepts raw raster points directly (direct variant)
Use the rasterizing variants if the raster table rows are not already sorted in row-major order (for example, if they represent an arbitrary 2D point cloud), or if filtering or binning is required to reduce the input data to a manageable count (to speed up the contour processing) or to smooth the input data before contour processing. If the input rows do not already form a rectilinear region, the output region will be their 2D bounding box. Many of the parameters of the rasterizing variant are directly equivalent to those of tf_geo_rasterize; see that function for details.
The direct variants require that the input rows represent a rectilinear region of pixels in nonsparse row-major order. The dimensions must also be provided, and (raster_width * raster_height) must match the input row count. The contour processing is then performed directly on the raster values with no preprocessing.
The line variants generate LINESTRING geometries that represent the contour lines of the raster space at the given interval with the optional given offset. For example, a raster space representing a height field with a range of 0.0 to 1000.0 will likely result in 10 or 11 lines, each with a corresponding contour_values
value, 0.0, 100.0, 200.0 etc. If contour_offset
is set to 50.0, then the lines are generated at 50.0, 150.0, 250.0, and so on. The lines can be open or closed and can form rings or terminate at the edges of the raster space.
The polygon variants generate POLYGON geometries that represent regions between contour lines (for example from 0.0 to 100.0), and from 100.0 to 200.0. If the raster space has multiple regions with that value range, then a POLYGON row is output for each of those regions. The corresponding contour_values
value for each is the lower bound of the range for that region.
lon
Longitude value of raster point (degrees, SRID 4326).
Column<FLOAT | DOUBLE>
lat
Latitude value of raster point (degrees, SRID 4326).
Column<FLOAT | DOUBLE> (must be the same as <lon>)
value
Raster band value from which to derive contours.
Column<FLOAT | DOUBLE>
agg_type
bin_dim_meters
neighborhood_fill_radius
fill_only_nulls
fill_agg_type
flip_latitude
Optionally flip resulting geometries in latitude (default FALSE).
(This parameter may be removed in future releases)
BOOLEAN
contour_interval
Desired contour interval. The function will generate a line at each interval, or a polygon region that covers that interval.
FLOAT/DOUBLE (must be same type as value)
contour_offset
Optional offset for resulting intervals.
FLOAT/DOUBLE (must be same type as value)
raster_width
Pixel width (stride) of the raster data.
INTEGER
raster_height
Pixel height of the raster data.
INTEGER
contour_[lines|polygons]
Output geometries.
Column<LINESTRING | POLYGON>
contour_values
Raster values associated with each contour geometry.
Column<FLOAT | DOUBLE> (will be the same type as value)
See
See
See
See
See