[postgis-users] Help with ST_CLIP

Simon SPDBA Greener simon at spdba.com.au
Thu Mar 11 22:37:21 PST 2021

"POSTGIS=""2.4.3 r16312"" PGSQL=""100"" GEOS=""3.6.2-CAPI-1.10.2 
4d2925d6"" PROJ=""Rel. 4.9.3, 15 August 2016"" GDAL=""GDAL 2.2.3, 
released 2017/11/20"" LIBXML=""2.9.4"" LIBJSON=""0.12.1"" 

I have a polygon that defines the boundary of the Great Barrier Reef.

A) That boundary is stored as a vector geography column (4326) in a table.
B) I have loaded a raster dataset of depths (4326) and checked its 
     The data loaded correctly and I can see valid depth values.

Now I want to clip the data in B with the polygon in A.

(I can't use a raster function with a geography object so I cast it to 

create table gbr100x100clip
select ST_Clip(g.rast, 1, m.geog::geometry, false) as rast
   from gbr_marine_park_boundary as m,
        gbr100x100 as g;

This works but the value (depth) of the whole (slipped) rasters is NULL.

I expected to see depth values but this returns null values.

SELECT (stats).*
   FROM (SELECT ST_SummaryStats(rast, 1) As stats FROM gbr100x100clip) 
As foo
  order by max desc;

Can anyone give me an idea of what I am doing wrong?


More information about the postgis-users mailing list