Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2199 closed enhancement (fixed)

[raster] ST_Union only considering first band if uniontype specified

Reported by: robe Owned by: robe
Priority: medium Milestone: PostGIS 2.1.0
Component: documentation Version: master
Keywords: Cc:

Description

I'm not sure if this was just missed or too hard to do. If difficult, I guess we just need to amend the docs. Anyrate if I explicitly say 'LAST' vs. leaving it out I should get the same answer.

It seems ST_Union is still only returning first band if you specify a union type. Observe:

— this returns bright beautiful picture —

(WITH mset AS 
( SELECT ROW_NUMBER() OVER() As rnum, rast
  FROM (SELECT  ST_Tile(rast, (ST_Width(rast))::integer/2, ST_Height(rast)/2) As rast 
FROM (SELECT ST_Resize(rast,0.10,0.10) As rast
FROM pics 
WHERE filename='Mona_Lisa.jpg' LIMIT 1) As  foo
) As foofoo )
SELECT ST_Union(ST_SetUpperLeft(rast,ST_UpperLeftX(rast)*-1,ST_UpperLeftY(rast)*-1))
FROM mset where rnum IN(1,2))

— this returns grey scale — verified it ST_NumBands only returns 1 —-

SELECT ST_Union(ST_SetUpperLeft(rast,ST_UpperLeftX(rast)*-1,ST_UpperLeftY(rast)*-1), 'LAST')
FROM mset where rnum IN(1,2))

See attached images.

Using same image I described here from wikipedia

http://www.bostongis.com/blog/index.php?/archives/207-Waiting-for-PostGIS-2.1-ST_Tile.html

Attachments (2)

explicit_last.png (45.3 KB ) - added by robe 11 years ago.
default_last_behavior.png (132.6 KB ) - added by robe 11 years ago.

Download all attachments as: .zip

Change History (8)

by robe, 11 years ago

Attachment: explicit_last.png added

by robe, 11 years ago

Attachment: default_last_behavior.png added

comment:1 by robe, 11 years ago

Summary: [raster] ST_Union not considering other bands except for LAST[raster] ST_Union only considering first band if uniontype specified

comment:2 by Bborie Park, 11 years ago

Status: newassigned

Gah! I'm on it.

comment:3 by Bborie Park, 11 years ago

Looking at the docs, I evidently stated that "ST_Union(rast) now unions all bands of all input rasters". I believe I intended ST_Union(rast) unioning all bands to only apply to variant #1.

comment:4 by robe, 11 years ago

Component: rasterdocumentation
Owner: changed from Bborie Park to robe
Status: assignednew
Type: defectenhancement

Ah I see you wrote ST_Union(rast). I guess I wasn't looking closely. Maybe we can make it clearer. I'll just change this to a documentation enhancement and fix later, since its technically not wrong just could be clearer.

comment:5 by robe, 11 years ago

Resolution: fixed
Status: newclosed

Okay I reworded at r11081 just so I don't get confused :)

http://postgis.net/docs/manual-dev/RT_ST_Union.html

I'll put in as an enhancement if not ticketed already

comment:6 by robe, 11 years ago

I reworded yet again at r11082 as I realized when writing this long diatribe and trying to explain this oddball that it's only

ST_Union(rast,uniontype) that is problematic.

Also documented that the unionarg variant is new in 2.1.0.

Note: See TracTickets for help on using tickets.