0
How to extract raster data from a Shape? */
printf("%d\n", 42); /* Como fazer para extrair dados de raster a partir de um shape
0
How to extract raster data from a Shape? */
printf("%d\n", 42); /* Como fazer para extrair dados de raster a partir de um shape
0
Hello, probably what you want is a Mask
library(raster)
#raster exemplo
r<-raster(ncol=10,nrow=10)
r[]<-1:ncell(r)
plot(r)
#poligono exemplo
pol<-raster(ncol=2,nrow=2)
pol[]<-1:ncell(pol)
pol<-as(pol,"SpatialPolygons")[1]
plot(r);plot(pol,add=T)
#crop ou mask para cortar
c1<-crop(r,pol)
m1<-mask(r,pol)
#mask nao altera o extent, o crop sim
#retornar valores do raster cortado
v1<-values(c1) #valores sem NA
v2<-values(m1) #valores com NA
Browser other questions tagged r
You are not signed in. Login or sign up in order to post.
Your question is not clear. Please set what type of Shape, raster etc. Put some example of the data you want to do the transformation.
– Daniel Ikenaga
I have a tif file and I have a polygono inside the raster.
– M.J.E
really, can’t understand your question at all, man, try sending a Toy version of your code to agnt give you a help
– Guilherme Marthe