[GRASS-user] creating two new maps from one existing raster

Hi all,
i have a raster that i simply want to split in two along a line designated by me, thereby creating two separate rasters. i have attempted to digitize using v.digit, displaying the raster and drawing a line around the area of interest. i go through the motions of what i think is closing the line, then save and exit. but v.info shows no data attached to this new vector, and when i try to display, nothing shows up.

can anyone tell me how to make 2 rasters out of my 1 along a user specified line, or how to successfully digitize this?
thank you,
Janet

On 8/16/12, Janet Choate <jsc.eco@gmail.com> wrote:

Hi all,
i have a raster that i simply want to split in two along a line designated
by me, thereby creating two separate rasters. i have attempted to digitize
using v.digit, displaying the raster and drawing a line around the area of
interest. i go through the motions of what i think is closing the line,
then save and exit. but v.info shows no data attached to this new vector,
and when i try to display, nothing shows up.

can anyone tell me how to make 2 rasters out of my 1 along a user specified
line, or how to successfully digitize this?
thank you,
Janet

Hi Janet,

I don't know of a command that just splits a raster (maybe there is one??)

But one way to do it is to use r.digit and create a file named MASK for each
of the separate rasters. Then use r.mapcalc to create new rasters.

Example:

# remove any old MASK file
g.remove MASK

# set the region to the raster you want to split up
g.region rast=old

# display the raster you want to work on (i.e. d.mon start=x0 select=x0)
d.rast old

# run r.digit on the current raster (old)
r.digit output=MASK
  ## use mouse keys to define new raster named MASK
  ## save with X

# use r.mapcalc (not g.copy) to create a raster called 'new1'
# that automatically applies the MASK you selected
r.mapcalc new1=old

# clean up and view results
d.erase
g.remove MASK

# view the original raster (old)
d.rast old

# view the new raster
d.rast new1

repeat steps for the other half of the raster (new2, etc...)

note:
Use v.extract and then v.to.rast if you want to create a MASK for features
base on queries (instead of a mouse based MASK).

hth

L. Prevett

I think the easiest would be to set your region, temporarily, to cover just the area of interest up to the cut line. THen do r.mapcalc new_rast=old_rast. Now, if necessary go back to the old region. g.region save=original_region g.region -p n=… s=… e=… w=… # set up to the cut line r.mapcalc new_rast=old_rast g.region region=original_region If the area of interest is not rectangulalr, then follow L.Previtt’s suggestion.

···

On 16/08/2012 22:09, Janet Choate wrote:

Hi all,
i have a raster that i simply want to split in two along a line designated by me, thereby creating two separate rasters. i have attempted to digitize using v.digit, displaying the raster and drawing a line around the area of interest. i go through the motions of what i think is closing the line, then save and exit. but v.info shows no data attached to this new vector, and when i try to display, nothing shows up.

can anyone tell me how to make 2 rasters out of my 1 along a user specified line, or how to successfully digitize this?

thank you,
Janet

This mail was received via Mail-SeCure System.

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)

This mail was received via Mail-SeCure System.

-- 
Micha Silver
052-3665918