[postgis-users] Help with ST_CLIP

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Fri Mar 12 10:42:47 PST 2021

Hi Simon,

A geography column in 4236 sounds strange. Check the coordinate values 
of the cast polygon.

select st_astext(geog::geometry) from gbr_marine_park_boundary;

and see if they look like what you expect.

-Steve W

On 3/12/2021 1:37 AM, Simon SPDBA Greener wrote:
> "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 
> statistics.
>     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 
> geometry.)
> create table gbr100x100clip
> as
> 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?
> regards
> Simon
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users

This email has been checked for viruses by Avast antivirus software.

More information about the postgis-users mailing list