raster
ADVANCED
This module contains procedures to access and operate with raster data that has been loaded into Snowflake with our Raster Loader.
Learn more about loading raster data as raster tables in Snowflake following this guide.
warning
The current version of the raster module in the Analytics Toolbox only works with raster-loader>=0.5.0
.
RASTER_VALUES
Description
Returns each pixel and associated values from a output_expression
across all bands in a given area of interest of a raster table. The result will include the data from the input_query
as well as from all bands, corresponding to the pixels that intersect each geography.
raster_table
:STRING
the qualified table name of the raster table, e.g.'your_project.your_dataset.your_tablename'
.input_query
:STRING
query containing the area of interest in which to perform the extraction, stored in a column namedgeom
. Additional columns can be included into this query in order to be referenced from theoutput_expression
. It can beNULL
, in which case all values stored in the raster table will be extracted.output_expression
:STRING
contains the bands and values to be extracted from the raster. This expression support alias. It does not support aggregations. If you need to use aggregations, use theRASTER_AGG_VALUES
function. This expression can beNULL
if apixel
column is added using theinclude_pixel
option.output_table
:VARCHAR
where the resulting table will be stored. It must be aVARCHAR
of the form'your_database.your_schema.your_tablename'
. The schema must exist and the caller needs to have permissions to create a new table on it. The process will fail if the target table already exists.options
:STRING
a JSON string with additional options. So far, the only supported option isinclude_pixel
. If true, apixel
column with the quadbin index corresponding to each extracted value will be added to the output table. By default, nopixel
column is added.
Result
The result is a table with the corresponding values extracted from the output_expression
and, if selected, a pixel
column with quadbin indexes.
Examples
RASTER_AGG_VALUES
Description
Returns aggregated values for all pixels intersecting the specified geometries, according to an output_expression
.
raster_table
:VARCHAR
the qualified table name of the raster table, e.g.'your_project.your_dataset.your_tablename'
.input_query
:VARCHAR
query containing the area of interest in which to perform the aggregation, stored in a column namedgeom
. Additional columns can be included into this query in order to be referenced from theoutput_expression
. It can beNULL
, in which case all values stored in the raster table will be used.output_expression
:VARCHAR
contains the aggregated values to be computed from the raster. For extracting non-aggregated values, use theRASTER_VALUES
function. This expression cannot beNULL
.output_table
:VARCHAR
where the resulting table will be stored. It must be aVARCHAR
of the form'your_database.your_schema.your_tablename'
. The schema must exist and the caller needs to have permissions to create a new table on it. The process will fail if the target table already exists.options
:VARCHAR
a JSON VARCHAR with additional options. So far, the only supported option isgroupby_column
, which should contain an array of names of columns to use to group by. If this option is not provided, one single row will be added to the output table for each row in the input table. Otherwise, multiple rows will be added for each original row.
Result
The result is a table with the corresponding aggregated values from the output_expression
and, if selected, a pixel
column with quadbin indexes.
Examples
Last updated