Opened 7 years ago

Closed 5 years ago

#3725 closed defect (wontfix)

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

Reported by: yosukesabai Owned by: Bborie Park
Priority: medium Milestone: PostGIS 3.0.0
Component: raster Version: 2.3.x
Keywords: Cc:

Description

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

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

postgis_full_version()
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_Clip(
                ST_AddBand(
                        ST_MakeEmptyRaster(16, 16, 0, 0, 1, 1, 0, 0),
                        ARRAY[
                        ROW(1, '8BUI'::text, 0, 255),
                        ROW(2, '8BUI'::text, 0, 255),
                        ROW(3, '8BUI'::text, 0, 255)
                        ]::addbandarg[]
                ),
                ST_GeomFromText('POLYGON((16 0, 16 1, 17 1, 17 0, 16 0))')
        )
);

Change History (4)

comment:1 by robe, 7 years ago

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

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 by dbaston, 7 years ago

Milestone: PostGIS 2.4.0PostGIS 2.5.0

comment:3 by robe, 6 years ago

Milestone: PostGIS 2.5.0PostGIS 3.0.0

comment:4 by robe, 5 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.