This topic describes the applications of the raster model, its basic components, and provides a quick start guide.
Model uses
Introduction
A raster model consists of a matrix of cells, or pixels, organized into rows and columns, where each cell contains a value, such as temperature. Raster models are used to store and compute raster data, such as digital aerial photographs, satellite imagery, digital pictures, and scanned maps.
Ganos Raster is a spatiotemporal engine extension for PolarDB for PostgreSQL (Compatible with Oracle). It enables these databases to efficiently store and manage raster data. Ganos Raster also supports the fusion and analysis of multi-source raster data, such as remote sensing, photogrammetry, and thematic maps. It provides a GeoServer plugin to help you publish raster objects in the database as Open Geospatial Consortium (OGC) standard services, such as WMS or WMTS. Ganos Raster can be used in various fields, including meteorology, environmental monitoring, geological exploration, natural resource management, national defense, emergency response, telecommunications, media, transportation, urban planning, and homeland security.
Function overview
Ganos Raster supports direct import from multiple external formats, such as TIFF, IMG, HDF, NetCDF, and GRIB. You can also export raster objects from the database to these formats.
After importing raster data, you can query the basic properties, band statistics, and pixel value statistics of raster objects. You can also retrieve the pixel matrix in multiple ways.
You can also perform various operations on raster objects, such as projection transformation, cropping, band operations, mosaicking, and color balancing.
Ganos Raster provides dynamic tiling capabilities for fast visualization of raster objects.
Main business scenarios
In practical applications, Ganos Raster can be used for various scenarios that involve raster data storage and analysis:
Smart agriculture
Ganos Raster supports efficient storage and querying of large-scale remote sensing satellite data. By performing joint queries, band calculations, and spatial statistics on spatial thematic data and remote sensing imagery from multiple sources, you can address various data analysis challenges in agricultural production. You can also connect to DataV to visualize data with a wide variety of maps and statistical charts to efficiently guide agricultural production.

Meteorological and hydrological prediction
Ganos Raster supports the import and fast querying of standard data formats commonly used in meteorology and hydrology, such as HDF, NetCDF, and GRIB. It also provides functions such as spatial interpolation and isoline or isosurface extraction. This lets you quickly obtain key information for meteorological and hydrological services and provides critical technical support for disaster prevention.
Financial and insurance services
Using the satellite remote sensing image band calculation and classification technologies provided by Ganos Raster, you can quickly perform statistical analysis on crop types, areas, and growth conditions across different times and locations. By combining this analysis with data such as farmers' self-certified cultivated land, government-registered land transfers, and other factors such as climate, geographical location, and market conditions, you can use professional industry risk control models to estimate crop yield and value. This information helps in determining credit lines and reasonable repayment periods for farmers.
Basic components
Raster model overview
The data model consists of the following elements:
Raster: A single raster dataset, such as a remote sensing image scene or a TIFF file.
Tile: A data block, which is a collection of pixels. A tile is the basic storage unit for a raster object in the database. A tile typically contains 256 × 256 pixel values.
Band: A 2D raster data layer composed of multiple tiles. Each tile has a row and column number.
Cell: Represents a pixel in a tile and can have different data types, such as Byte, Short, Int, or Double.
Pyramid: A raster pyramid created by progressive downsampling for faster display. Each pyramid contains different levels. Each level corresponds to a layer, and level 0 represents the raw data.
Metadata: The metadata for the raster data, including its spatial extent, projection type, pixel type, and more.

As shown in the preceding figure, Ganos Raster uses a simple and efficient universal raster data model to manage thematic data and remote sensing imagery. A raster dataset (Image) is stored as a raster object in the database. A raster object is logically composed of several bands that can be represented as 2D raster layers. The information for each band is read from the raw image data during the import process. Raster objects are stored and managed using basic storage units called tiles. The default size of a tile is 256 × 256 pixels, but you can also define the size. Each tile can contain one or more bands. A pixel in a tile is represented by a cell. Each raster object has corresponding metadata, such as extent, data type, projection information, and row and column numbers. If a pyramid model is created for the raster data, a band will contain pyramid data at multiple levels.
Spatial reference system
A Spatial Reference System (SRS) defines how to associate a raster object with a specific location on the Earth's surface.
Ganos uses an integer, called a spatial reference identifier (SRID), to reference the definition of an SRS. A raster object is associated with an SRS through its SRID value.
For more information, see Spatial reference.
Data column view
In Ganos, `raster_columns` is a view that lists all raster columns from the database system catalog tables. The structure is as follows:
Column name | Type | Description |
r_table_catalog | varchar(256) | Usually a static field: postgres. |
r_table_schema | varchar(256) | The schema where the table resides. |
r_table_name | varchar(256) | The name of the table. |
r_raster_column | varchar(256) | The name of a Raster column in the table. |
You can query all geometry data columns in the current database using the following statement:
SELECT * FROM raster_columns;Index
A spatial index allows Ganos to avoid full sequential database scans when processing large spatial datasets. An index speeds up searches by organizing data into a search tree, which can be quickly traversed to find specific records.
Ganos provides two indexing methods for raster data:
Index name | Description | Index features |
B-tree | A B-tree index is typically used for raster file names to perform searches by comparing file names. | B-tree is the most common indexing method in databases and can accelerate the widest range of query types. |
GIN (Generalized Inverted Index) | GIN stands for Generalized Inverted Index. This index structure allows for fast searches of tuples that contain specific keywords. Therefore, a GIN index is particularly suitable for full-text search. You can create this type of index on Raster fields. | A GIN index is best for static data because lookups are very fast. However, index updates are slower than with a GiST index. |
Advantages of Ganos Raster
Compared to the built-in Raster plugin of the open source spatial database PostGIS, Ganos Raster has significant advantages in application flexibility, storage cost, and computing capabilities. The main advantages are as follows:
The Ganos Raster storage structure is better aligned with business needs
Unlike the fully rasterized storage method of PostGIS Raster, Ganos Raster provides an object-oriented storage structure. When a raster dataset, such as an image or a Digital Elevation Model (DEM), is imported, it corresponds to a single row in a Ganos Raster table. This creates a clear one-to-one relationship. There is no limit on the capacity of a single object. A single row can store an extremely large image or raster file exceeding 1 TB. Ganos Raster abstracts away direct operations on tiles, records the complete metadata of raster objects, and can be closely associated with time series data. This allows for better integration with business services.
Ganos Raster supports cost-effective data storage
Because of its unique schema design, Ganos Raster supports storing raster metadata in the database and raster attribute data on a more affordable service, such as Object Storage Service (OSS). This is ideal for scenarios with high storage costs, such as large-scale image analysis. Even in this configuration, you can still perform various spatial analysis operations on the raster data while significantly reducing storage costs.
Ganos Raster has more spatiotemporal operators
In addition to supporting traditional operations such as raster spatial relationship determination, raster pyramids, raster pixel values, raster properties, and raster image editing, Ganos Raster also supports a variety of unique raster statistics and raster algebra operations. It also supports professional image color balancing algorithms and overviews for massive raster datasets to accelerate rendering.
Quick start
Introduction
This quick start guide provides a brief introduction to the Ganos Raster engine. It covers basic tasks, including creating extensions and tables, importing data, running queries, creating pyramids, cropping data, and exporting results.
Syntax description
Create an extension.
CREATE extension ganos_raster cascade;NoteInstall the extension in the public schema to avoid permission issues.
CREATE extension ganos_raster WITH schema public cascade;Create a raster table.
CREATE TABLE raster_table(id integer, rast raster);Import raster data from OSS.
INSERT INTO raster_table VALUES(1, ST_ImportFrom('chunk_table','OSS://<ak>:<ak_secret>@oss-cn-internal.aliyuncs.com/bucket/data/image.tif'))NoteYou must use Access OSS over IPv6. For more information, see Object Storage Service paths.
Replace
<ak>and<ak_secret>with your actual AccessKey ID and AccessKey secret.
Query raster object information.
SELECT ST_Height(rast),ST_Width(rast) FROM raster_table WHERE id = 1; ----------- 1241 (1 rows)Query statistics for a specified band.
SELECT ST_Statistics(rast,0) FROM raster_table WHERE id=1; --------------------- {"approximate":false,"min":8969.0,"max":12351.0,"mean":9407.330013839151,"std":193.4268180351078,"count":70091,"sum":659369168.0,"mode":9366.0,"median":9392.0} (1 row)Create a pyramid.
UPDATE raster_table SET rast = ST_BuildPyramid(rast) WHERE id = 1; UPDATE 1Calculate the optimal pyramid level based on the world coordinate range, width, and height of the viewport.
SELECT ST_BestPyramidLevel(rast, '((128.0, 30.0),(128.5, 30.5))', 800, 600) FROM raster_table WHERE id = 10; --------------------- 3Retrieve the pixel matrix for a specified range of the raster.
SELECT ST_Clip(rast, 0, '((128.980,30.0),(129.0,30.2))', 'World') FROM raster_table WHERE id = 1;Calculate the pixel coordinate range of the cropped area.
SELECT ST_ClipDimension(rast, 2, '((128.0, 30.0),(128.5, 30.5))') FROM raster_table WHERE id = 10; ------------------------- '((600, 720),(200, 300))'Crop and export.
Crop a raster object by specifying a geometry and export it as a Cloud-Optimized GeoTIFF (COG) file.
SELECT ST_ExportTo( ST_ClipToRast(rast, ST_GeomFromText('POLYGON((128.0 30.0,129.0 30.0,129.0 31.0,128.0 31.0,128.0 30.0))',4326),0), 'COG', 'OSS://<ak>:<ak_secret>@oss-cn.aliyuncs.com/mybucket/data/image_clip.tif' ); ------------- t (1 row)Delete the extension (optional).
DROP extension ganos_raster cascade;
SQL reference
For the complete SQL reference, see Raster SQL reference.