cog
GDAL-freier Cloud-Optimized-GeoTIFF-(COG)-Reader — entfernte Raster vor Ort über HTTP-Range-Reads abfragen, mit STAC-Katalogintegration
Maintainer: thsghdud13
Installation und Laden
INSTALL cog FROM community;LOAD cog;Beispiel
-- Anonymous access to public S3 buckets needs: export AWS_SKIP_SIGNATURE=trueLOAD cog;
-- List the tile grid of a remote Sentinel-2 COG (metadata-only range reads — never the pixels)SELECT level, tile_x, tile_y, bbox, crsFROM read_cog('https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/52/S/CG/2026/6/S2B_52SCG_20260630_0_L2A/B04.tif')LIMIT 3;
-- Sedona-style raster accessors: metadata, a pixel value, zonal statistics (native CRS coordinates)SELECT RS_Width(f) AS width, RS_SRID(f) AS srid, RS_Value(f, 325210.0, 4121100.0) AS red, round(RS_ZonalStats(f, [322000.0, 4119000.0, 326400.0, 4123200.0], 1, 'mean'), 1) AS zonal_meanFROM (SELECT 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/52/S/CG/2026/6/S2B_52SCG_20260630_0_L2A/B04.tif' AS f);-- width = 10980, srid = 32652, red = 1748.0, zonal_mean = 1916.4
-- Search a live STAC API (POST /search, pagination followed automatically)SELECT s.item_id, s.datetimeFROM read_stac_search('https://earth-search.aws.element84.com/v1/search', collections := ['sentinel-2-l2a'], bbox := [127.02, 37.21, 127.04, 37.23], datetime := '2026-06-28T00:00:00Z/2026-07-02T00:00:00Z') sWHERE s.asset_key = 'red';Über cog
cog stellt Cloud-Optimized-GeoTIFF-Raster als SQL-Tabellen bereit — an Ort und Stelle, über
HTTP/S3-Range-Reads, ohne Umkodierung, ohne Reprojektion und ohne
GDAL/PROJ/GEOS im Lesepfad (TIFF-Dekodierung und Abruf werden an
async-tiff delegiert).
Oberfläche: read_cog() für die Kachelraster-Auflistung, read_stac() / read_stac_search()
zur STAC-Katalogintegration (statische Dokumente und Live-POST-/search-APIs mit
Paginierung) sowie ein Sedona-artiger RS_*-Skalarkatalog (Metadaten-Zugriffe,
Pixelzugriff über RS_Value/RS_Values, RS_NormalizedDifference,
RS_ZonalStats, RS_BandAsArray). Jedes pixelbezogene Ergebnis wird
in der CI gegen ein rasterio-Orakel gegencheckt. Wiederholte entfernte Zugriffe
bedient ein prozessweiter Metadaten-Cache.
Benchmarks und die vollständige SQL-Oberfläche finden Sie in der README.
Hinzugefügte Funktionen
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| RS_BandAsArray | scalar | NULL | NULL | |
| RS_BandNoDataValue | scalar | NULL | NULL | |
| RS_BandStats | scalar | NULL | NULL | |
| RS_GeoReference | scalar | NULL | NULL | |
| RS_Height | scalar | NULL | NULL | |
| RS_MetaData | scalar | NULL | NULL | |
| RS_NormalizedDifference | scalar | NULL | NULL | |
| RS_NumBands | scalar | NULL | NULL | |
| RS_RasterToWorldCoord | scalar | NULL | NULL | |
| RS_SRID | scalar | NULL | NULL | |
| RS_ScaleX | scalar | NULL | NULL | |
| RS_ScaleY | scalar | NULL | NULL | |
| RS_SkewX | scalar | NULL | NULL | |
| RS_SkewY | scalar | NULL | NULL | |
| RS_UpperLeftX | scalar | NULL | NULL | |
| RS_UpperLeftY | scalar | NULL | NULL | |
| RS_Value | scalar | NULL | NULL | |
| RS_Values | scalar | NULL | NULL | |
| RS_Width | scalar | NULL | NULL | |
| RS_WorldToRasterCoord | scalar | NULL | NULL | |
| RS_ZonalStats | scalar | NULL | NULL | |
| cog_cache_stats | table | NULL | NULL | |
| cog_io_bench | table | NULL | NULL | |
| cog_version | table | NULL | NULL | |
| read_cog | table | NULL | NULL | |
| read_stac | table | NULL | NULL | |
| read_stac_search | table | NULL | NULL |
Überladene Funktionen
Diese Erweiterung fügt keine Funktionsüberladungen hinzu.
Hinzugefügte Typen
Diese Erweiterung fügt keine Typen hinzu.
Hinzugefügte Einstellungen
Diese Erweiterung fügt keine Einstellungen hinzu.