Raster data consists of a matrix of cells or pixels. The cells or pixels are organized into rows and columns to form a grid. Each cell contains a value that represents information, such as temperature.

Overview

Raster data can be digital aerial photographs, satellite images, digital images, or scanned maps.

PolarDB for PostgreSQL and PolarDB databases compatible with Oracle implement the raster model. This allows Ganos to store and analyze raster data in a cost-effective manner with the help of database technologies and methods.

Quick start

  • Create an extension.

    Create Extension Ganos_Raster cascade;
  • Create a raster table.

    Create Table raster_table(id integer, raster_obj raster);
  • Import raster data from Object Storage Service (OSS).

    Insert into raster_table Values(1, ST_ImportFrom('chunk_table','OSS://ABCDEFG:1234567890@oss-cn.aliyuncs.com/mybucket/data/4.tif'))
  • Query raster object information.

    Select ST_Height(raster_obj),ST_Width(raster_obj) From raster_table Where id = 1;
  • Create a pyramid.

    Update raster_table Set raster_obj = ST_BuildPyramid(raster_obj) Where id = 1;
  • Calculate the optimal pyramid level based on the world space, width, and height of a viewport.

    Select ST_BestPyramidLevel(raster_obj, '((128.0, 30.0),(128.5, 30.5))', 800, 600) from raster_table where id = 10;
    
    ---------------------
    3
  • Retrieve a pixel matrix from the specified space of a raster object.

    Select ST_Clip(raster_obj, 0, '((128.980,30.0),(129.0,30.2))', 'World') From raster_table Where id = 1;
  • Calculate the raster space of a clipped area.

    Select ST_ClipDimension(raster_obj, 2, '((128.0, 30.0),(128.5, 30.5))') from rater_table where id = 10;
    
    ------------------------------------
    '((600, 720),(200, 300))'
  • Delete the extension.

    Drop Extension Ganos_raster cascade;

SQL reference

For more information, see Raster SQL reference.