[R-sig-Geo] Rasterize function with maximum in R

Ashraf Afana asafaneh at yahoo.com
Thu Nov 16 10:04:38 CET 2017


Hi all,

I have some concerns regarding the rasterize option in R and I would like to know if the fun=max in rasterize in R provides similar results to the one achieved by using "Polygon to Raster using maximum-combined-area" in ArcGIS?

I'm trying to rasterize a habitat layer to a raster of 10m spatial resolution using the function 'max' (e.g. r <- rasterize(ht, r, "Priority", fun = 'max') and I would like to assign the habitat of the largest overlapping area, which is similar to the “maximum-combined-area”. My original layer contains the habitat information as a character string values (e.g. K1, K2, I1, I2, I3, etc.) of 20 classes. Before resterizing, I have converted these classes to numeric (e.g. in my case 1 to 20).
I have my doubts about the validity and type of maximums generated by this code. From what I can see, I’m not sure if the use of fun= ‘max’ in Rasterize in R implies the use of the absolute maximum or the combined maximum area. My point is if I convert the original character string values of Priority to numeric, the maximum for the numeric values will have nothing to do with the maximum combined area under cover. For example, if we have a pixel which is covered by 90% of habitat 1 and 10% of habitat 15, the value of the pixel will be assigned to the habitat 15. Does that make any sense? Any suggestion or clarification would be appreciated.Regards
 Ashraf, 


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list