Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use <code>projectRaster</code> for this if you have a raster in one projection and resolution and you need output in a different particular resolution and projetion. </p> <p>The <code>from</code> argument is your high resolution raster and the <code>to</code> argument is your low res raster. Make sure you choose the correct method for aggregation (i.e. <code>bilinear</code> for continuous data and <code>ngb</code> (nearest neighbour) for categorical data.</p> <pre><code>require( raster ) # Projection info proj1 &lt;- CRS("+proj=laea +lon_0=20 +lat_0=5 +ellps=sphere +unit=km +to_meter=1e3") proj2 &lt;- CRS("+proj=longlat +datum=WGS84 +ellps=WGS84") # High res raster r1km &lt;- raster( nrows = 1515 , ncols = 2300 , xmn = -4000 , xmx = -1700 , ymn = -15 , ymx = 1500 , crs = proj1 ) # Low res raster r5km &lt;- raster( nrows = 303 , ncols = 460 , xmn = -20 , xmx = -5 , ymn = 4 , ymx = 15 , crs = proj2 ) # Set some values in high res raster pts &lt;- rasterToPoints(r1km) values( r1km ) &lt;- 0.01*pts[,1] + sin(0.02*pi*pts[,2]) # Reproject using the attributes of the low res raster for output out &lt;- projectRaster( from = r1km , to = r5km , method = "bilinear" ) # Plot - extent of second raster doesn't fully cover first so some data is missing par( mfrow = c(1,2) ) plot( r1km ) plot( out ) </code></pre> <p><img src="https://i.stack.imgur.com/U3YHt.png" alt="enter image description here"></p> <p>If your input and output data are the same except in resolution you can use aggregate...</p> <pre><code># If same extent and resolution require use aggregate r1 &lt;- raster(system.file("external/rlogo.grd", package="raster")) r5 &lt;- aggregate( r1 , fact = 5 , method = "bilinear" ) par( mfrow = c(1,2) ) plot( r1 ) plot( r5 ) </code></pre> <p><img src="https://i.stack.imgur.com/I0L7D.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload