Question

Does anyone have any tips about how to share raster layers (or a part of it) in forums like this? I'd like to ask a question and give some reproducible data but I'm not sure what is the best way to do it.

Thanks a lot in advance!

Was it helpful?

Solution

stackoverflow, gis.stackexchange, r-sig-geo and the examples in the manuals of sp and the raster package and other packages are full of examples how to do that. Here are some:

library(raster)
# example files
f1 <- system.file("external/test.grd", package="raster")
r <- raster(f1)
f2 <- system.file("external/rlogo.grd", package="raster")
b <- brick(f2)

# create your own 
x <- raster(nrow=18, ncol=36)
values(x) <- runif(ncell(x))
y <- raster(nrow=10, ncol=10, xmn=0, xmx=10, ymn=0, ymx=10, crs='+proj=utm +zone=2')
values(y) <- 1:ncell(y)

OTHER TIPS

Answer given by Frede Aakmann Tøgersen.

For geographical data 'data(meuse.grid)' can be used as an example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top