Ticket #339 (closed task: fixed)

Opened 3 years ago

Last modified 2 years ago

[raster] ST_Band

Reported by: mloskot Owned by: dustymugs
Priority: medium Milestone: PostGIS 2.0.0
Component: raster Version: trunk
Keywords: history Cc:

Description (last modified by pracine) (diff)

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

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

Change History

Changed 3 years ago by mloskot

  • owner changed from pracine to mloskot
  • status changed from new to assigned

Changed 3 years ago by pracine

  • version set to trunk

Changed 3 years ago by pracine

  • priority changed from medium to low
  • description modified (diff)

Changed 3 years ago by pracine

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

Changed 3 years ago by pracine

  • owner changed from mloskot to pracine
  • status changed from assigned to new
  • milestone changed from WKTRaster 0.1.6 to PostGIS 2.0.0

Changed 3 years ago by pracine

  • status changed from new to assigned

Changed 3 years ago by pracine

  • summary changed from [wktraster] Implement ST_Band function for raster to [raster] Implement ST_Band function for raster

Changed 2 years ago by pracine

  • milestone changed from PostGIS 2.0.0 to PostGIS Raster Future

Changed 2 years ago by pracine

  • status changed from assigned to new

Changed 2 years ago by dustymugs

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?

Changed 2 years ago by pracine

Sounds good!

Changed 2 years ago by dustymugs

  • owner changed from pracine to dustymugs
  • status changed from new to assigned

Changed 2 years ago by dustymugs

  • summary changed from [raster] Implement ST_Band function for raster to [raster] ST_Band

Changed 2 years ago by dustymugs

Adds ST_Band support. Includes core and regression tests

Changed 2 years ago by dustymugs

  • priority changed from low to medium

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

Changed 2 years ago by dustymugs

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

Changed 2 years ago by dustymugs

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

patch -p1 < st_band.patch

Changed 2 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.)

Changed 2 years ago by dustymugs

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 2 years ago by dustymugs

Refactored to account for changed memory handling.

Changed 2 years ago by dustymugs

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.

Changed 2 years ago by dustymugs

  • keywords history added
  • status changed from assigned to closed
  • resolution set to fixed

Added in r7147.

Changed 2 years ago by dustymugs

  • milestone changed from PostGIS Raster Future to PostGIS 2.0.0
Note: See TracTickets for help on using tickets.