HEAVY.AI Docs
v8.1.0
v8.1.0
  • Welcome to HEAVY.AI Documentation
  • Overview
    • Overview
    • Release Notes
  • Installation and Configuration
    • System Requirements
      • Hardware Reference
      • Software Requirements
      • Licensing
    • Installation
      • Free Version
      • Installing on Docker
        • HEAVY.AI Installation using Docker on Ubuntu
      • Installing on Ubuntu
        • HEAVY.AI Installation on Ubuntu
        • Install NVIDIA Drivers and Vulkan on Ubuntu
      • Installing on Rocky Linux / RHEL
        • HEAVY.AI Installation on RHEL
        • Install NVIDIA Drivers and Vulkan on Rocky Linux and RHEL
      • Getting Started on AWS
      • Getting Started on GCP
      • Getting Started on Azure
      • Getting Started on Kubernetes (BETA)
      • Upgrading
        • Upgrading HEAVY.AI
        • Upgrading from Omnisci to HEAVY.AI 6.0
        • CUDA Compatibility Drivers
      • Uninstalling
      • Ports
    • Services and Utilities
      • Using Services
      • Using Utilities
    • Executor Resource Manager
    • Configuration Parameters
      • Overview
      • Configuration Parameters for HeavyDB
      • Configuration Parameters for HEAVY.AI Web Server
      • Configuration Parameters for HeavyIQ
    • Security
      • Roles and Privileges
        • Column-Level Security
      • Connecting Using SAML
      • Implementing a Secure Binary Interface
      • Encrypted Credentials in Custom Applications
      • LDAP Integration
    • Distributed Configuration
  • Loading and Exporting Data
    • Supported Data Sources
      • Kafka
      • Using HeavyImmerse Data Manager
      • Importing Geospatial Data
    • Command Line
      • Loading Data with SQL
      • Exporting Data
  • SQL
    • Data Definition (DDL)
      • Datatypes
      • Users and Databases
      • Tables
      • System Tables
      • Views
      • Policies
      • Comment
    • Data Manipulation (DML)
      • SQL Capabilities
        • ALTER SESSION SET
        • ALTER SYSTEM CLEAR
        • DELETE
        • EXPLAIN
        • INSERT
        • KILL QUERY
        • LIKELY/UNLIKELY
        • SELECT
        • SHOW
        • UPDATE
        • Arrays
        • Logical Operators and Conditional and Subquery Expressions
        • Table Expression and Join Support
        • Type Casts
      • Geospatial Capabilities
        • Uber H3 Hexagonal Modeling
      • Functions and Operators
      • System Table Functions
        • generate_random_strings
        • generate_series
        • tf_compute_dwell_times
        • tf_feature_self_similarity
        • tf_feature_similarity
        • tf_geo_rasterize
        • tf_geo_rasterize_slope
        • tf_graph_shortest_path
        • tf_graph_shortest_paths_distances
        • tf_load_point_cloud
        • tf_mandelbrot*
        • tf_point_cloud_metadata
        • tf_raster_contour_lines; tf_raster_contour_polygons
        • tf_raster_graph_shortest_slope_weighted_path
        • tf_rf_prop_max_signal (Directional Antennas)
        • ts_rf_prop_max_signal (Isotropic Antennas)
        • tf_rf_prop
      • Window Functions
      • Reserved Words
      • SQL Extensions
      • HeavyIQ LLM_TRANSFORM
  • HeavyImmerse
    • Introduction to HeavyImmerse
    • Admin Portal
    • Control Panel
    • Working with Dashboards
      • Dashboard List
      • Creating a Dashboard
      • Configuring a Dashboard
      • Duplicating and Sharing Dashboards
    • Measures and Dimensions
    • Using Parameters
    • Using Filters
    • Using Cross-link
    • Chart Animation
    • Multilayer Charts
    • SQL Editor
    • Customization
    • Joins (Beta)
    • Chart Types
      • Overview
      • Bubble
      • Choropleth
      • Combo
      • Contour
      • Cross-Section
      • Gauge
      • Geo Heatmap
      • Heatmap
      • Linemap
      • Number
      • Pie
      • Pointmap
      • Scatter Plot
      • Skew-T
      • Table
      • Text Widget
      • Wind Barb
    • Deprecated Charts
      • Bar
      • Combo - Original
      • Histogram
      • Line
      • Stacked Bar
    • HeavyIQ SQL Notebook
  • HEAVYIQ Conversational Analytics
    • HeavyIQ Overview
      • HeavyIQ Guidance
  • HeavyRF
    • Introduction to HeavyRF
    • Getting Started
    • HeavyRF Table Functions
  • HeavyConnect
    • HeavyConnect Release Overview
    • Getting Started
    • Best Practices
    • Examples
    • Command Reference
    • Parquet Data Wrapper Reference
    • ODBC Data Wrapper Reference
    • Raster Data Wrapper Reference
  • HeavyML (BETA)
    • HeavyML Overview
    • Clustering Algorithms
    • Regression Algorithms
      • Linear Regression
      • Random Forest Regression
      • Decision Tree Regression
      • Gradient Boosting Tree Regression
    • Principal Components Analysis
  • Python / Data Science
    • Data Science Foundation
    • JupyterLab Installation and Configuration
    • Using HEAVY.AI with JupyterLab
    • Python User-Defined Functions (UDFs) with the Remote Backend Compiler (RBC)
      • Installation
      • Registering and Using a Function
      • User-Defined Table Functions
      • RBC UDF/UDTF Example Notebooks
      • General UDF/UDTF Tutorial Notebooks
      • RBC API Reference
    • Ibis
    • Interactive Data Exploration with Altair
    • Additional Examples
      • Forecasting with HEAVY.AI and Prophet
  • APIs and Interfaces
    • Overview
    • heavysql
    • Thrift
    • JDBC
    • ODBC
    • Vega
      • Vega Tutorials
        • Vega at a Glance
        • Getting Started with Vega
        • Getting More from Your Data
        • Creating More Advanced Charts
        • Using Polys Marks Type
        • Vega Accumulator
        • Using Transform Aggregation
        • Improving Rendering with SQL Extensions
      • Vega Reference Overview
        • data Property
        • projections Property
        • scales Property
        • marks Property
      • Migration
        • Migrating Vega Code to Dynamic Poly Rendering
      • Try Vega
    • RJDBC
    • SQuirreL SQL
    • heavyai-connector
  • Tutorials and Demos
    • Loading Data
    • Using Heavy Immerse
    • Hello World
    • Creating a Kafka Streaming Application
    • Getting Started with Open Source
    • Try Vega
  • Troubleshooting and Special Topics
    • FAQs
    • Troubleshooting
    • Vulkan Renderer
    • Optimizing
    • Known Issues and Limitations
    • Logs and Monitoring
    • Archived Release Notes
      • Release 6.x
      • Release 5.x
      • Release 4.x
      • Release 3.x
Powered by GitBook
On this page
  • Rasterizing Variant
  • Direct Variant
Export as PDF
  1. SQL
  2. Data Manipulation (DML)
  3. System Table Functions

tf_raster_contour_lines; tf_raster_contour_polygons

Previoustf_point_cloud_metadataNexttf_raster_graph_shortest_slope_weighted_path

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 ()

  • One which accepts raw raster points directly ()

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 ; 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

SELECT
  contour_[lines|polygons],
  contour_values
FROM TABLE(
  tf_raster_contour_[lines|polygons](
    raster => CURSOR(
      <lon>,
      <lat>,
      <value>
    ),
    agg_type => ‘<agg_type>’,
    bin_dim_meters => <bin_dim_meters>,
    neighborhood_fill_radius => <neighborhood_fill_radius>,
    fill_only_nulls => <fill_only_nulls>,
    fill_agg_type => ‘<fill_agg_type>’,
    flip_latitude => <flip_latitude>,
    contour_interval => <contour_interval>,
    contour_offset => <contour_offset>
  )
);

Direct Variant

SELECT
  contour_[lines|polygons],
  contour_values
FROM TABLE(
  tf_raster_contour_[lines|polygons](
    raster => CURSOR(
      <lon>,
      <lat>,
      <value>
    ),
    raster_width => <raster_width>,
    raster_height => <raster_height>,
    flip_latitude => <flip_latitude>,
    contour_interval => <contour_interval>,
    contour_offset => <contour_offset>
  )
);

Input Arguments

Parameter
Description
Data Types

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

Output Columns

Name
Description
Data Types

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)

Examples

SELECT
  contour_lines,
  contour_values
FROM TABLE(
  tf_raster_contour_lines(
    raster => CURSOR(
      SELECT
        lon,
        lat,
        elevation
      FROM
        elevation_table
    ),
    agg_type => ‘AVG’,
    bin_dim_meters => 10.0,
    neighborhood_fill_radius => 0,
    fill_only_nulls => FALSE,
    fill_agg_type => ‘AVG’,
    flip_latitude => FALSE,
    contour_interval => 100.0,
    contour_offset => 0.0
  )
);
SELECT
  contour_polygons,
  contour_values
FROM TABLE(
  tf_raster_contour_polygons(
    raster => CURSOR(
      SELECT
        lon,
        lat,
        elevation
      FROM
        elevation_table
    ),
    raster_width => 1024,
    raster_height => 1024,
    flip_latitude => FALSE,
    contour_interval => 100.0,
    contour_offset => 0.0
  )
);

See

See

See

See

See

rasterizing variant
direct variant
tf_geo_rasterize
tf_geo_rasterize
tf_geo_rasterize
tf_geo_rasterize
tf_geo_rasterize
tf_geo_rasterize