[postgis-users] Tiling multidimensional rasters

David Haynes haynesd2 at gmail.com
Mon Jun 30 07:33:28 PDT 2014


Hello,

I am working on a project that incorporates large scale rasters across the
world. For instance, we have datasets that describe barely crops where each
pixel has 1 or 0 value indicating presence of barely. We have successfully
incorporated the rasters into our system using the raster data type.
However, for data accessing reasons, we would like to take advantage of the
multibanding rast and making large raster "stacks". Where we have taken an
empty raster and added bands to it from other rasters. Initially this
worked fine using the following statements to create the blank raster and
then add bands. However, this resulted in a non-tiled raster.

select ST_AddBand(ST_MakeEmptyRaster(clip.rast), 1 , '32BF') as rast from (
SELECT (ST_Union(ST_Clip(Barely.rast, poly.geom)) as rast FROM my_bound
poly inner join rasters Barelyon ST_Intersects(Barely.rast, poly.geom)
WHERE Barely.raster_variable_id = 103 ) clip;

SELECT ST_AddBand(r.rast, clip.rast,2) as rast FROM gis_rasters.test r, (
select ST_Union(ST_Clip(wheat.rast,poly.geom)) as rast from my_bound poly
inner join rasters wheat on ST_Intersects(wheat.rast,poly.geom)
where wheat.raster_variable_id = 106 ) clip;


When the statements were adjusted to tile the raster the number of raster
bands changes.
If only the Create Statement is adjusted to have tiling, 2 additional bands
are created. ST_AddBand(*ST_Tile*(ST_MakeEmptyRaster(clip.rast), 1 ,
'32BF') *,135,135)*
If I added 4 bands, this statement would report 6 bands

SELECT (ST_BandMetadata(w.rast, band)).* FROM  gis_rasters.test3 w,
generate_series(1,ST_NumBands(w.rast)) as band

Tiling each raster bands results in double the number of bands
SELECT ST_AddBand(r.rast, clip.rast,2) as rast FROM gis_rasters.test r,
( select *ST_Tile*(ST_Union(ST_Clip(wheat.rast,poly.geom))*,135,135)* as
rast from my_bound poly inner join rasters wheat on
ST_Intersects(wheat.rast,poly.geom) where wheat.raster_variable_id = 106 )
clip;

Have I over looked something or am I making a simple mistake? Is there a
way to incorporate both?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140630/39c9c0a0/attachment.html>


More information about the postgis-users mailing list