Created
October 23, 2015 16:13
-
-
Save hakimabdi/d9cb36ee4f3ef3e1ed29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################## | |
# title : mosaicGTiffs.R | |
# purpose : Takes in projected GeoTIFF outputs from projHDF2GTiff or | |
# : other GeoTIFFS and mosaics them into on larger file | |
# author : Abdulhakim Abdi (@HakimAbdi) | |
# input : Individual GeoTIFF files | |
# output : A mosaicked GeoTIFF file with a larger extent | |
############################################################################## | |
mosaicGTiffs = function(proj.loc, gtiffs, mosaicName, overwrite){ | |
if("gdalUtils" %in% rownames(installed.packages()) == FALSE){ # checks if gdalutils is installed | |
install.packages("gdalUtils", repos="http://r-forge.r-project.org") | |
require(gdalUtils) | |
} | |
suppressWarnings(dir.create(paste(proj.loc,"Mosaicked",sep="/"))) # creates a directory to store mosaicked file | |
gdalwarp(gtiffs, paste(proj.loc,"/","Mosaicked","/",mosaicName,".tif",sep=""),overwrite = overwrite) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment