Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1938 closed enhancement (fixed)

[raster] Refactor ST_AddBand to add multiple new bands in one call

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


Currently, the basic ST_AddBand() looks like…

	rast raster,
	index int,
	pixeltype text,
	initialvalue float8 DEFAULT 0.,
	nodataval float8 DEFAULT NULL

) -> raster

But the problem is that to add multiple new bands, you have to call ST_AddBand many times. And if the raster has huge dimensions (e.g. 1000 x 1000) or many bands, the deserializing and serializing of the raster takes longer and longer as you add more bands.

Instead, ST_AddBand should have the ability to add multiple new bands at once. This will require a new data type…

CREATE TYPE addbandarg AS (
	index int,
	pixeltype text,
	initialvalue float8,
	nodataval float8

And a new "main" function…

	rast raster,
	addbandargset addbandarg[]
) -> raster

The original "main" ST_AddBand() function (first code above) will now call the new "main" function.

Usage example:

	St_Value(rast, 1, 3, 3),
	St_Value(rast, 2, 3, 3)
			ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0, 0),
				ROW(1, '64BF', 1234.567, NULL),
				ROW(2, '8BUI', 255, NULL)
		) AS rast
) foo;

Change History (3)

comment:1 by Bborie Park, 12 years ago

Resolution: fixed
Status: newclosed

Added in r10130

comment:2 by Bborie Park, 12 years ago

Keywords: history added

comment:3 by pracine, 12 years ago

Regina will be soooo happy!

Note: See TracTickets for help on using tickets.