Skip to content

How to change raster cell value by coordinates?

3 messages · Roman Luštrik, Thiago V. dos Santos

#
Dear list,

  I wonder if there is a way to change the values of a raster grid using the coordinates as a condition. Please consider the raster below:
class       : RasterLayer
dimensions  : 47, 65, 3055  (nrow, ncol, ncell)
resolution  : 0.5, 0.5  (x, y)
extent      : -74, -41.5, -17.5, 6  (xmin, xmax, ymin, ymax)
coord. ref. : NA
values      : /home/data/amz.img
min value   : 0
max value   : 1

  This is what I would like to do:
Package "raster" offers a 'replacement' function that seemed promising, but its arguments are row and column numbers, instead of coordinates.

  Could anyone please point out another option?
2 days later