R : How to find the location of the max value in a raster? -


how can find location of max. value in raster using r? know max. value of raster, need find location.

let's try toy raster follows:

library(raster) r = raster(nrow=10, ncol=10) r[] = runif(100,0,10) 

then position (index) of maximum found using

idx = which.max(r) 

and thhe index position coordinates of cell

pos = xyfromcell(r,idx) 

let me know if works


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -