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

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Dec 21 16:23:13 CET 2016


Hi Michiel,

in my first reply to this list yesterday I mentioned the function
sf::st_interpolate_aw (area-weighted) which has an argument "extensive"
that has to be set to TRUE or FALSE; when TRUE, amounts are
redistributed proportionality to the target area. It seems you have an
extensive variable (amount), so you could use that.

For this you need to install package sf from source, by

devtools::install_github("edzer/sfr")

Both datasets need to be polygon. Let me know if it works, or when you
have trouble getting it to work (more likely!)

Best regards,

On 21/12/16 16:06, Dijk, Michiel van wrote:
> 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
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20161221/49fac2be/attachment.bin>


More information about the R-sig-Geo mailing list