柵格資料由按行和列組織的像元(也稱為像素)矩陣組成,其中每個像元都包含一個資訊值(例如溫度)。
概述
柵格資料可以是數字航空像片、衛星影像、數字圖片或甚至掃描的地圖。
GanosBase Raster通過在RDS for PostgreSQL中實現柵格資料模型,可以藉助於資料庫的技術和方法高效地對柵格資料進行儲存和分析操作。
快速入門
建立擴充
Create Extension Ganos_Raster with schema public cascade;建立柵格表
Create Table raster_table(id integer, raster_obj raster);從OSS中匯入柵格資料
Insert into raster_table Values(1, ST_ImportFrom('chunk_table','OSS://ABCDEFG:1234567***@oss-cn.aliyuncs.com/mybucket/data/4.tif'))查詢柵格對象資訊
Select ST_Height(raster_obj),ST_Width(raster_obj) From raster_table Where id = 1;建立金字塔
Update raster_table Set raster_obj = ST_BuildPyramid(raster_obj) Where id = 1;根據視口的全局座標範圍,長和寬來計算最佳的金字塔層級
Select ST_BestPyramidLevel(raster_obj, '((128.0, 30.0),(128.5, 30.5))', 800, 600) from raster_table where id = 10; --------------------- 3擷取柵格指定範圍的像素矩陣
Select ST_Clip(raster_obj, 0, '((128.980,30.0),(129.0,30.2))', 'World') From raster_table Where id = 1;計算裁剪地區的像素座標範圍
Select ST_ClipDimension(raster_obj, 2, '((128.0, 30.0),(128.5, 30.5))') from raster_table where id = 10; ------------------------------------ '((600, 720),(200, 300))'刪除擴充
Drop Extension Ganos_raster cascade;
SQL參考
詳細SQL手冊請參見Raster SQL參考 。