I'm having trouble merging two raster datasets that have different resolution and extent, and have irregular point data. Below is info on each raster. I need these datasets to merge according to the grid points so that I can run a fire spread model (which requires both wind and slope data).

I have tried converting to normal dataframes (using rasterToPoints) before merging but the differences lead to loss of a lot of grid points.

I have tried to align the rasters with project raster and rasterize, but I haven't managed to get it to work.

Data from https://globalwindatlas.info/downloads/gis-files
> wind <- raster("ZAF_wind-speed_10m.tif"); wind
class      : RasterLayer 
dimensions : 11271, 11804, 133042884  (nrow, ncol, ncell)
resolution : 0.0025, 0.0025  (x, y)
extent     : 13.33407, 42.84407, -50.31423, -22.13673  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +no_defs 
source     : C:/Users/s2000128/Documents/Flammability modelling/ZAF/ZAF_wind-speed_10m.tif 
names      : ZAF_wind.speed_10m  

Data from https://datacatalog.worldbank.org/dataset/world-slope-model
> slope <- raster("ZAF1_msk_alt.grd"); slope
class      : RasterLayer 
dimensions : 1548, 1992, 3083616  (nrow, ncol, ncell)
resolution : 0.008333333, 0.008333333  (x, y)
extent     : 16.4, 33, -34.9, -22  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +ellps=WGS84 +no_defs 
source     : C:/Users/s2000128/Documents/Flammability modelling/slope_deg_0/slope_deg/ZAF1_msk_alt.grd 
names      : ZAF1_msk_alt 
values     : -26, 3264  (min, max)

Here are some examples of what I have tried:


windresampled <- projectRaster(wind,slope,method = 'ngb'); windresampled


wind_points <- rasterToPoints(wind) 
coordinates(wind_points) = ~x+y 
proj4string(wind_points) = CRS("+init=epsg:4326")
gridded(wind_points) = TRUE 
g_wind <- raster(wind_points); g_wind 
extent(wind) <- c(16.4,33, -34.9,-22) 
res(wind) <- c(0.0025, 0.0025) 
r_wind <- rasterize(wind_points, g_wind, field = wind_points$z, fun = mean, na.rm = TRUE)
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works. What software are you using?
    – Ian Turton
    Apr 28 '21 at 7:46
  • Thanks for the edits. I am doing everything in RStudio (R version 4.0.5).
    – Sarah
    Apr 28 '21 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.