forked from GIScience/OSMlanduse-BFM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmosaik_raster.R
29 lines (23 loc) · 809 Bytes
/
mosaik_raster.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
###MOSAIK RASTER###
#This script mosaics the LULC change maps of the Landsat sub-tiles to one LULC
#change map and saves it as a Geotiff.
#set working directory
setwd('./data/landsat/INDEX_FOLDER')
#list all change maps for LULC conversion to certain class (adapt, if necessary)
tiles <- list.files(full.names = T , recursive =T, pattern='\\urban.tif$')
tiles
#make empty raster list
your_length <- 0
rast_list <- rep(NA, your_length)
#import tiles as raster into the raster list
for (tile in tiles){
rast = raster(tile)
rast_list <- c(rast_list, rast)
}
#merge rasters and save geotiff
path.mrg='./output/'
rast_list$tolerance <- 1
rast_list$filename <- paste0(path.mrg, "osmlanduseplus_pasture_to_urban.tif")
#rast_list$overlap <- FALSE
rast_list$overwrite <- TRUE
mm <- do.call(merge, rast_list)