[GRASS-user] reclass raster with all unique values?

I have a raster map with watersheds that are the same value. Is there an easy way to reclass the map with every distinc basin to have a unique value?

many thanks,

--
Stephen Sefick
**************************************************
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**************************************************
sas0025@auburn.edu
http://www.auburn.edu/~sas0025
**************************************************

Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals.

                                 -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                               -Robert Gentleman

You might have already thought of these techniques, but here are two options that quickly come to mind…

You should be be able to mask each watershed individually (from a vector layer), and then run r.reclass on the area within each watershed boundary.

Alternatively, if you have a vector layer for watershed boundaries, what about creating a numeric attribute in which you assign each unique watershed a different number. Then, rasterize the watershed layer.

If you have a lot of watersheds, it seems like the second option would be easier… and there obviously might be a more elegant solution that I’m not aware of.

Hope that helps!

Mike

···

On Fri, Jul 5, 2013 at 2:03 PM, Stephen Sefick <sas0025@auburn.edu> wrote:

I have a raster map with watersheds that are the same value. Is there an easy way to reclass the map with every distinc basin to have a unique value?

many thanks,


Stephen Sefick


Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849


sas0025@auburn.edu
http://www.auburn.edu/~sas0025


Let’s not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals.

-K. Mullis

“A big computer, a complex algorithm and a long time does not equal science.”

-Robert Gentleman


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

You could convert the raster layer to a vector layer. In the attribute table you’ll have a column with the raster value (the watershed values) and the cat column, which gives you the unique identifier for each polygon. Next you just convert the vector back to raster using the cat column as raster value.

But depending on your data, you might also want to check out r.clump or r.clump2 (I think the latter is a add-on).

Paulo

···

On Fri, Jul 5, 2013 at 11:03 PM, Stephen Sefick <sas0025@auburn.edu> wrote:

I have a raster map with watersheds that are the same value. Is there an easy way to reclass the map with every distinc basin to have a unique value?

many thanks,


Stephen Sefick


Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849


sas0025@auburn.edu
http://www.auburn.edu/~sas0025


Let’s not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals.

-K. Mullis

“A big computer, a complex algorithm and a long time does not equal science.”

-Robert Gentleman


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user