Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#339 closed task (fixed)

[raster] ST_Band

Reported by: mloskot Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: history Cc:

Description (last modified by pracine)

This tasks belongs to the Objective 0.1.6f specified in the WKT Raster roadmap

As stated in the comment 7 of the Specification Comments following the Code Sprint in http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking01, we should prefer the option of adding a band parameter to every function working on a single band like ST_AsTIFF(). In all these cases, if the band parameter is omitted, the function should work on the first band.

ST_Band() is nevertheless a must have function for future release.

Attachments (3)

st_band.patch (14.9 KB) - added by Bborie Park 10 years ago.
Adds ST_Band support. Includes core and regression tests
st_band.2.patch (15.1 KB) - added by Bborie Park 10 years ago.
tweaked patch so that patch can be applied in same manner as all dependent patches
st_band.3.patch (15.1 KB) - added by Bborie Park 10 years ago.
Refactored to account for changed memory handling.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 11 years ago by mloskot

Owner: changed from pracine to mloskot
Status: newassigned

comment:2 Changed 11 years ago by pracine

Version: trunk

comment:3 Changed 11 years ago by pracine

Description: modified (diff)
Priority: mediumlow

comment:4 Changed 11 years ago by pracine

If we agree on lowering the priority of this ticket I will update the planification.

comment:5 Changed 10 years ago by pracine

Milestone: WKTRaster 0.1.6PostGIS 2.0.0
Owner: changed from mloskot to pracine
Status: assignednew

comment:6 Changed 10 years ago by pracine

Status: newassigned

comment:7 Changed 10 years ago by pracine

Summary: [wktraster] Implement ST_Band function for raster[raster] Implement ST_Band function for raster

comment:8 Changed 10 years ago by pracine

Milestone: PostGIS 2.0.0PostGIS Raster Future

comment:9 Changed 10 years ago by pracine

Status: assignednew

comment:10 Changed 10 years ago by Bborie Park

As part of the FV.01, I propose the following function versions for ST_Band:

ST_Band(rast raster, nbands int[]) -> raster

nbands is an array of 1-based band indices of the bands to copy into the output raster

Ex: For a raster rast with 3 bands:

ST_Band(rast, ARRAY[1,3,2])

ST_Band(rast, ARRAY[3,2,1])

You can rearrange the bands as above. You can also duplicate the bands:

ST_Band(rast, ARRAY[1,2,3,2,1])

ST_Band(rast raster, nband int) -> raster

nband is a single integer of the 1-based band index of the band to copy into the output raster

Ex: ST_Band(rast, 1)

ST_Band(rast, 3)

ST_Band(rast raster, nbands text) -> raster

nbands is a comma separated string of 1-based band indices indicating the bands to copy into the output raster

Ex: ST_Band(rast, '1,2')

ST_Band(rast, '1,2,3, 1, 1 , 2')

ST_Band(rast raster)

the band to extract is automatically assumed to be one.

Ex: ST_Band(rast) -> raster

Should I include a expanded version of the ST_Band(rast raster, nbands text) to provide the ability to specify the delimiter?

comment:11 Changed 10 years ago by pracine

Sounds good!

comment:12 Changed 10 years ago by Bborie Park

Owner: changed from pracine to Bborie Park
Status: newassigned

comment:13 Changed 10 years ago by Bborie Park

Summary: [raster] Implement ST_Band function for raster[raster] ST_Band

Changed 10 years ago by Bborie Park

Attachment: st_band.patch added

Adds ST_Band support. Includes core and regression tests

comment:14 Changed 10 years ago by Bborie Park

Priority: lowmedium

I've added a patch including ST_Band support. Core and regression tests are included.

Changed 10 years ago by Bborie Park

Attachment: st_band.2.patch added

tweaked patch so that patch can be applied in same manner as all dependent patches

comment:15 Changed 10 years ago by Bborie Park

Added new patch so that the patch can be applied in same manner as all other dependent incremental patches...

patch -p1 < st_band.patch

comment:16 Changed 10 years ago by pracine

ST_Band should not return an error when specified band(s) is or are out of range. It should follow the rule established at the tip of rt_pg.c and the behavior of other functions taking a band argument which is to return NULL with a NOTICE. (We might want to create an new ticket for that.)

comment:17 Changed 10 years ago by Bborie Park

OK. I'll make the appropriate changes to all the other patches based upon that rule in rt_pg.c. I guess I never paid attention to that rule. My fault.

Changed 10 years ago by Bborie Park

Attachment: st_band.3.patch added

Refactored to account for changed memory handling.

comment:18 Changed 10 years ago by Bborie Park

Attached latest ST_Band patch (st_band.3.patch) to refactor for changed memory handling. Merges cleanly against r7145. This is the first in the series of incremental patches.

comment:19 Changed 10 years ago by Bborie Park

Keywords: history added
Resolution: fixed
Status: assignedclosed

Added in r7147.

comment:20 Changed 10 years ago by Bborie Park

Milestone: PostGIS Raster FuturePostGIS 2.0.0
Note: See TracTickets for help on using tickets.