...
library(SiteExploitationTerritories)
dem <- raster("../data/SET_SRTM90.asc") crs(dem) <- CRS('+init=EPSG:31467') slope = '' pts <- SiteExploitationTerritories::pts
The DEM will be cropped to an extent of 5 km around the sites.
dem.croped <- BufferCrop(pts = pts, dem = dem, extent = 5) plot(dem.croped)
# Create Environment for multi-core computation library(doParallel) library(parallel) cl <- makeCluster(detectCores() - 1) print(cl) registerDoParallel(cl)
start.time <- Sys.time() a <- SiteExploitationTerritories(pts = pts, dem = dem, slope = slope, epsg = 31467) end.time <- Sys.time() time.taken <- end.time - start.time time.taken
# view the output site <- 1 plot(a[[site]][[1]]) # plot the Time-Cost Raster plot(a[[site]][[2]], add = TRUE) # plot the Contour Lines
for (i in 1:length(a)) { TCR = paste("../../output/Site", i, "TimeCostRaster", sep = "_") CTL = paste("../../output/Site", i, "ContourLines", sep = "_") rdt = "ascii" writeRaster(a[[i]][[1]], TCR, format = rdt, overwrite = TRUE) # write time cost raster shapefile(a[[i]][[2]], filename = CTL, overwrite = TRUE) # write contourlines shapefile }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.