[GRASS-user] Combining 2d rasters to 3d using point files

Moritz Lennert mlennert at club.worldonline.be
Fri May 3 05:54:17 PDT 2019

On 26/04/19 03:40, Francois Chartier wrote:
> Hi
> I would like to combine potentially 100s of 2d rasters into one 3d raster.
> Instead of using r.to.rast3 which could take a long time to prepare the 
> setting, is there a way to export the raster as point files, and combine 
> them using for example MsAccess, and then reimporting them into one 3d 
> raster file?
> Alternatively, is it possible to combine several 3d raster into one 3d 
> raster?  i could combine ten 2d rasters into one and then combine the 
> multiple 3d rasters into one larger one.

If Stefan's suggestion does not help, and if each 2D raster is of one 
constant height, you could try a combination of r.out.xyz and r3.in.xyz 
with some magic in between to include a z. Here's an uncomplete and 
untested algorithm for Linux in

height = 0

for each raster:
	height = height + step
	r.out.xyz raster out=- | awk -v var=$height -F'|' '{print 
$1,$2,var,$3}' >> combined_raster


r3.in;xyz combined_raster


More information about the grass-user mailing list