Opened 6 months ago

Last modified 3 days ago

#3725 new defect

[raster] ST_Clip with multiple band raster throws exception when geometry only touches

Reported by: yosukesabai Owned by: dustymugs
Priority: medium Milestone: PostGIS 2.5.0
Component: raster Version: 2.3.x
Keywords: Cc:


I realized that ST_Clip(raster, geometry) gives following error message under particular condition:

ERROR: RASTER_clip: Could not get band from working raster CONTEXT: PL/pgSQL function st_clip(raster,integer[],geometry,double precision[],boolean) line 8 at RETURN

This happens, I think, when (1) raster has multi-band and (2) raster and geometry (polygon) touches with no shared interior. Below is example sql command for demo.

My version

PostgreSQL 9.6.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.9.1, 64-bit

POSTGIS="2.3.1 r15264" GEOS="3.6.0-CAPI-1.10.0 r0" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.1 .2, released 2016/10/24" LIBXML="2.9.4" LIBJSON="0.12.1" RASTER

-- This fails
SELECT ST_Summary(
                        ST_MakeEmptyRaster(16, 16, 0, 0, 1, 1, 0, 0),
                        ROW(1, '8BUI'::text, 0, 255),
                        ROW(2, '8BUI'::text, 0, 255),
                        ROW(3, '8BUI'::text, 0, 255)
                ST_GeomFromText('POLYGON((16 0, 16 1, 17 1, 17 0, 16 0))')

Change History (2)

comment:1 Changed 2 months ago by robe

Component: postgisraster
Milestone: PostGIS 2.3.3PostGIS 2.4.0
Owner: changed from pramsey to dustymugs

As noted in #3730, changed the error to a NOTICE.

I'm pushing this one to PostGIS 2.4, because I think we might be able to do better than that by perhaps adding an extra arg to ST_Clip if a touched pixel should be returned. I recall we had discussions about it before.

comment:2 Changed 3 days ago by dbaston

Milestone: PostGIS 2.4.0PostGIS 2.5.0
Note: See TracTickets for help on using tickets.