tf_raster_contour_lines; tf_raster_contour_polygons
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.
Rasterizing Variant
Direct Variant
Input Arguments
Parameter | Description | Data Types |
---|---|---|
| Longitude value of raster point (degrees, SRID 4326). | Column<FLOAT | DOUBLE> |
| Latitude value of raster point (degrees, SRID 4326). | Column<FLOAT | DOUBLE> (must be the same as <lon>) |
| Raster band value from which to derive contours. | Column<FLOAT | DOUBLE> |
| See tf_geo_rasterize |
|
| See tf_geo_rasterize |
|
| See tf_geo_rasterize |
|
| See tf_geo_rasterize |
|
| See tf_geo_rasterize |
|
| Optionally flip resulting geometries in latitude (default FALSE). (This parameter may be removed in future releases) | BOOLEAN |
| 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) |
| Optional offset for resulting intervals. | FLOAT/DOUBLE (must be same type as value) |
| Pixel width (stride) of the raster data. | INTEGER |
| Pixel height of the raster data. | INTEGER |
Output Columns
Name | Description | Data Types |
---|---|---|
| Output geometries. | Column<LINESTRING | POLYGON> |
| Raster values associated with each contour geometry. | Column<FLOAT | DOUBLE> (will be the same type as value) |
Examples
Last updated