When I run r.resample to crop a map by using a vector and a mask, the resulting map has the same shape as the vector that I used but does not replicate (exactly) the portion of the raster map that I used as input in the r.resample. It produced a map with altered elevation values that is different from the raster map I used as input. I read that r.resample just "crops" the raster that is its input and does not alter it. I do not know why r.resample alters the output map
-
This question (although it doesn't seem to) actually asks the same thing as the answered one at gis.stackexchange.com/q/6736/664 . The answer is to avoid resampling by making sure the output and input grids are precisely registered.– whuberMar 8, 2011 at 17:27
-
How can it be done in GRASS? r.resample just crops a given input map and produces a new map containing the selection of the mask. I cannot see how to make sure that the output and input grids are precisely registered– teamAngatMar 8, 2011 at 17:42
1 Answer
You can change the region resolution with g.region rast=inputmap
so the region will have the same resolution as inputmap. Then r.resample will output a map with that resolution. If that does not work you can try r.mapcalc outputmap=inputmap
instead of r.resample.
After that copy the colortable from one map to another: r.colors map=croppedmap rast=originalmap
.
-
I tried changing the region and setting it with the inputmap.I also tried using r.mapcalc. Both still produced a map with altered values. I noticed that it had altered values because the colors in the output raster map are different from the inputmap. Mar 9, 2011 at 14:37
-
1ok, maybe that's a problem with the colortable, try to copy the colortable from one map to another and see if it works: r.colors map=croppedmap rast=originalmap– PabloMar 9, 2011 at 17:35
-