[R-sig-Geo] Scaling coarse raster to finer raster using overlapping area weights

Dijk, Michiel van michiel.vandijk at wur.nl
Wed Dec 21 16:06:11 CET 2016


Hi,

I hope you can help me with the following. I have a coarse raster (0.5 x 0.5 degree) with information on global water demand (WD), which I want to combine with a higher resolution (5 arc min) global raster (which I have both in raster and polygon format). The higher resolution raster contains the locations of simulation units (SIMUs) that are related to a model. I would like to redistribute the  global water demand raster over the SIMUs. I first started with the 'resample' function in the raster package but this function allocates the total value for water demand to the cells with smaller resolution, resulting in much too large total water demand. What I am looking for is some sort of weighted disaggregation of values in the water demand raster to the SIMU raster using the share in overlapping area between cells in the two rasters. 

For example:
Suppose we have cell A in the water demand raster and this cell contains SIMUa, SIMUb and SIMUc (which can have different sizes). I would like to allocate the following value to SIMUa: Value in cell A x (Area SIMUa)/(Area cell A). Off course the first problem is that it is very well possible that only a part of SIMUa overlaps with Cell A so before I can start I need to (1) find the overlap between the Water demand raster and the SIMU raster and (2) calculate the area of SIMUa that overlaps with cell A. Here I already run into problems. 

I looked on the web for solutions and came across similar issues but none of it really worked. This post seems to come close:
http://gis.stackexchange.com/questions/155701/overlaying-grids-with-a-polygon-to-determine-the-average-value-of-the-overlappin

however when I run the gInteresects command to find the overlap  I get the following error: 

Error in RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) : 
  rgeos_binpredfunc_prepared: maximum returned dense matrix size exceeded

I assume that this is a memory issue but I could not find any information on the internet to solve this. Any recommendations to help me solve this particular issue or suggestions on other/better solutions to down scale the water demand raster are welcome. 

Many thanks,
Michiel


M. (Michiel) van Dijk, PhD
Research scholar | Ecosystems Services and Management (ESM) | International Institute for Applied Systems Analysis (IIASA) Senior researcher (out of office) | International Policy Division (IB) | Wageningen Economic Research

|Schlossplatz 1 - A-2361 Laxenburg, Austria, room s-138
S +43 2236 807 537
Skype: michiel.van.dijk
S https://www.researchgate.net/profile/Michiel_Van_Dijk/
/ http://nl.linkedin.com/pub/michiel-van-dijk/1a/805/346

www.iiasa.ac.at
www.wur.eu/economic-research



More information about the R-sig-Geo mailing list