Fwd: [GRASS-user] Generate 3D raster from two surfaces
soerengebbert at googlemail.com
Mon Feb 21 09:57:59 EST 2011
make sure your 3d region is set correctly, like:
g.region res=200 res3=200 t=2000 b=0 tbres=20
This will set a region with a 2d/3d resolution of 200m, the top at
2000m, the bottom at 0m and a top-bottom-resolution of 20m.
In this case you will have 100 layer.
Now fill the voxel cells below your surface and bottom with different
values, first we
create two helper maps which represent the values below the elevation maps.
r.mapcalc "one = 1"
r.mapcalc "two = 2"
Now start the module and set the elevation maps from top to bottom,
the flag -l will fill the cells below the elevation maps with the
r.to.rast3elev -l input=one,two elevation=surface,bottom output=volumemap
Your region of interest in the output volume map should have value 1.
You can use paraview to visualize the voxel map. Use r3.out.vtk to
export the voxel map.
Use the threshold filter in paraview to extract all cells with value 1.
r3.out.vtk input=volumemap output=/tmp/volumemap.vtk
Here are two (a bit old) presentations about 3d data handling with
grass and paraview:
2011/2/21 <grass at sundquist.imapmail.org>:
> I admit I am not a pro (but I have devoured both the 2nd and 3rd
> editions of "the book", and have been using GRASS on and of for about 5
> years now), but I am lost on this command.
> Here is part of what I am trying to do: Let's try showing just a 3D
> raster of the space between the ground surface and the bottom (I have a
> few otehr more intersting applications, too, but this is the simplest).
> I put GTiff exports of these files here:
> http://public.sundquist.imapmail.org/bottom_2.tif and
> I want to generate a 3D raster showing the space between these two
> I tried running this command:
> r.to.rast3elev input=ground_surface,AREA_DSM
> elevation=ground_surface,AREA_DSM output=3d1
> and got no errors but got essentially nothing:
> r3.univar input=3d1 at PERMANENT
> total null and non-null cells: 546
> total null cells: 469
> Of the non-null cells:
> n: 77
> minimum: 1
> maximum: 1
> range: 0
> mean: 1
> mean of absolute values: 1
> standard deviation: 0
> variance: 0
> variation coefficient: 0 %
> sum: 77
> I added to input files because when I tried just one, it said the number
> of input and elevation files must match. Note, I do not care about the
> actual values in the 3D raster, just whether they are null or not.
> Sorry if this is a basic question, but if I can get this generated, it
> would be very helpful for explaining something to a client.
> On Mon, 21 Feb 2011 06:06:37 +0100, "Soeren Gebbert"
> <soerengebbert at googlemail.com> said:
>> You can try r.to.rast3elev which will do exactly what you need.
>> Am 21.02.2011 02:38 schrieb <grass at sundquist.imapmail.org>:
>> > Hamish:
>> > I looked at that before and the only thing I could think of was to use
>> > r.to.rast3 by first generating a whole series of horizontal surfaces
>> > with r.mapcalc, one for each foot of elevation, with each cell getting a
>> > value of "1" if the "elevation" for that particular new surface lied
>> > between the corresponding cell values of the top and bottom surfaces.
>> > Then taking those whole bunch of surfaces and feeding them to
>> > r.to.rast3. But that seemed pretty inelegant. But it may be only way
>> > to do it. I would only be about 25 rasters to generate and then merge.
>> > J.S.
>> > On Sun, 20 Feb 2011 17:14:39 -0800 (PST), "Hamish" <hamish_b at yahoo.com>
>> > said:
>> >> J.S. wrote:
>> >> > I want to generate a 3D raster (and display in nviz) that is
>> >> > the volume between two 2D elevation rasters. The application
>> >> > is to visualize the subsuraface area that will be subject to
>> >> > environmental remediation.
>> >> maybe this summary helps,
>> >> http://grass.osgeo.org/wiki/Help_with_3D
>> >> Hamish
>> > _______________________________________________
>> > grass-user mailing list
>> > grass-user at lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/grass-user
> grass-user mailing list
> grass-user at lists.osgeo.org
More information about the grass-user