Load raster data

Updated at:
Copy as MD

Use ST_ImportFrom to load a raster data file from an on-premises computer or an Object Storage Service (OSS) bucket into GanosBase.GanosGanosGanosGanos

For a full list of raster-related functions, see Raster SQL reference. For ST_ImportFrom parameters, see ST_ImportFrom.

Prerequisites

Before you begin, make sure that you have:

  • An AnalyticDB for PostgreSQL instance that is authorized to access the raster data file

  • If loading from OSS, an OSS bucket in the same region as your AnalyticDB for PostgreSQL instance (see OSS domain names)

Syntax

INSERT INTO <raster_table_name>(<raster_column_name>) VALUES (ST_IMPORTFROM('<chunk_table_name>','<path_to_raster_file>'))

Load from an on-premises computer

  1. Create the Ganos_Raster extension.

    CREATE EXTENSION Ganos_Raster CASCADE
  2. Load the raster file.

    INSERT INTO raster_table(name, rast) VALUES ('local_file', ST_ImportFrom('chunk_table', '/home/beijing.tif'));

Load from an OSS bucket

  1. Create the Ganos_Raster extension if you haven't already.

    CREATE EXTENSION Ganos_Raster CASCADE
  2. Load the raster file using the OSS URI format.

    INSERT INTO raster_table(name, rast) VALUES ('oss_file', ST_ImportFrom('chunk_table', 'oss://ak:as@bucket/data/beijing.tif'));

Next steps