Opened 16 months ago

Last modified 6 months ago

#5317 new defect

ST_Union(rast, uniontype) treat bands with different classes as the same as first band — at Version 1

Reported by: shenzhuxi Owned by: pramsey
Priority: medium Milestone: PostGIS 3.5.0
Component: raster Version: 3.0.x
Keywords: Cc:

Description (last modified by shenzhuxi)

POSTGIS="3.0.0 r17983" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 " PROJ="6.3.1" GDAL="GDAL 3.0.4

Related to https://trac.osgeo.org/postgis/ticket/2200 ST_Union support multiple bands issue

If the $RASTER has multiple bands like ARRAY['8BUI', '16BUI'], the result of

            ST_Union(
              $RASTER,
              ARRAY[
                ROW(1, 'SUM'),
                ROW(2, 'MAX')
              ]::unionarg[]
            )

will be treated like ARRAY['8BUI', ' 8BUI'] and the max value will be 254 even the real value is a higher number in 16BUI.

ST_Union always uses the first band class to process the 2nd band and ignore the original class.

The same problem also can be triggered with ST_Union(setof raster rast, 2, text uniontype), if the first band is different from the second one.

Change History (1)

comment:1 by shenzhuxi, 16 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.