{"version":"1.0","type":"rich","title":"ST_ClipEx a working variation of ST_Clip for raster","description":"ST_ClipEx demonstrates a custom SQL function for clipping raster data in PostGIS, showing how to extract a rectangular subset of pixels from a larger raster grid. The function takes input coordinates and dimensions, then constructs a new empty raster with matching georeferencing properties before copying pixel values band by band. It iterates through each band and cell position using nested loops, applying ST_Value to read source pixels and ST_SetValue to write them into the clipped result. The code explicitly manages edge cases where the requested clip extends beyond the original raster bounds.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-1447686?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}