[R-sig-Geo] problem with rasterToPolygons x worldclim

Karla Shikev karlashikev at gmail.com
Mon Apr 4 21:32:26 CEST 2016


Dear all,

Here's an issue that is related to the previous one. In the commands below
I'm trying to make a polygon for all the regions within a range of mean
annual temps. However, rasterToPolygons will draw a square around each
value in the original raster, rather than providing me the actual polygon,
given that resolution. Any hints? Again, any help will be greatly
appreciated.

Karla

_____

library(raster)

r<-getData('worldclim', var='bio', res=10)$bio1

e <- extent(-140,-100, 50, 60)

xx<-crop(r,e)

slice1<-rasterToPolygons(xx, fun = function(x) {x > 40 & x < 60})

plot(slice1)

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list