Opened 14 years ago

Closed 13 years ago

Last modified 13 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 13 years ago.
Adds ST_Band support. Includes core and regression tests
st_band.2.patch (15.1 KB ) - added by Bborie Park 13 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 13 years ago.
Refactored to account for changed memory handling.

Download all attachments as: .zip

Change History (23)

comment:1 by mloskot, 14 years ago

Owner: changed from pracine to mloskot
Status: newassigned

comment:2 by pracine, 14 years ago

Version: trunk

comment:3 by pracine, 14 years ago

Description: modified (diff)
Priority: mediumlow

comment:4 by pracine, 14 years ago

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

comment:5 by pracine, 14 years ago

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

comment:6 by pracine, 14 years ago

Status: newassigned

comment:7 by pracine, 14 years ago

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

comment:8 by pracine, 13 years ago

Milestone: PostGIS 2.0.0PostGIS Raster Future

comment:9 by pracine, 13 years ago

Status: assignednew

comment:10 by Bborie Park, 13 years ago

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

Sounds good!

comment:12 by Bborie Park, 13 years ago

Owner: changed from pracine to Bborie Park
Status: newassigned

comment:13 by Bborie Park, 13 years ago

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

by Bborie Park, 13 years ago

Attachment: st_band.patch added

Adds ST_Band support. Includes core and regression tests

comment:14 by Bborie Park, 13 years ago

Priority: lowmedium

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

by Bborie Park, 13 years ago

Attachment: st_band.2.patch added

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

comment:15 by Bborie Park, 13 years ago

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

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 by Bborie Park, 13 years ago

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.

by Bborie Park, 13 years ago

Attachment: st_band.3.patch added

Refactored to account for changed memory handling.

comment:18 by Bborie Park, 13 years ago

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 by Bborie Park, 13 years ago

Keywords: history added
Resolution: fixed
Status: assignedclosed

Added in r7147.

comment:20 by Bborie Park, 13 years ago

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