[postgis-users] Creating a multiband raster from 3 single bandrasters

Paragon Corporation lr at pcorp.us
Sun Jul 7 22:50:59 PDT 2013


cough cough: New docs
 
http://postgis.net/docs/manual-dev/RT_ST_AddBand.html
 
-Regina
 

  _____  

From: postgis-users-bounces at lists.osgeo.org
[mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Bborie Park
Sent: Monday, July 08, 2013 12:38 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Creating a multiband raster from 3 single
bandrasters


Check out the last example (Multi-band versions) of ST_AddBand(). 

http://postgis.refractions.net/documentation/manual-svn/RT_ST_AddBand.html


-bborie


On Sun, Jul 7, 2013 at 8:43 PM, Mark Wynter <mark at dimensionaledge.com>
wrote:


I'm hoping someone can suggest a way of efficiently combining 3 individual
(but concordant) single band rasters into single raster having 3 bands?
We're working with PostgreSQL9.1, PostGIS2.1Beta.

The starting point is a single tiled raster with 3 bands representing RGB
values.

Let's say we perform some color smoothing on each of the RGB bands using
mapalgebra.

CREATE TABLE resample_myrastertable_b1 AS
SELECT rid, st_mapalgebrafctngb(rast, 1, '8BUI', 5, 5,
'st_mean4ma(float[][],text,text[])'::regprocedure, 'ignore', NULL) as rast
FROM original_rastertable;

CREATE TABLE resample_myrastertable_b2 AS
SELECT rid, st_mapalgebrafctngb(rast, 2, '8BUI', 5, 5,
'st_mean4ma(float[][],text,text[])'::regprocedure, 'ignore', NULL) as rast
FROM original_rastertable;

CREATE TABLE resample_myrastertable_b3 AS
SELECT rid, st_mapalgebrafctngb(rast, 3, '8BUI', 5, 5,
'st_mean4ma(float[][],text,text[])'::regprocedure, 'ignore', NULL) as rast
FROM original_rastertable;

This gives us 3 single-band results rasters.

How do we now join the individual smoothed RGB "results" rasters into a
single multiband "results" raster?   We'd also like to add a 4th band to the
"results" raster based on say a calculation which references the smoothed
values in bands 1-3.

I'm getting reasonably comfortable writing MapAlgebra callback expressions.
Its more a case of how do we efficiently handle table operations (e.g.
appending single band raster outputs) each time we perform some MapAlgebra?

Any suggestions and or a simple worked example would be most appreciated.

Many thanks

Mark




_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130708/0049dbc9/attachment.html>


More information about the postgis-users mailing list