problem with rasterToPolygons x worldclim
Hi Michael, Thanks for the tips. I tried the help for rasterToPolygons, but none of the options (e.g. dissolve=TRUE) made any difference. I tried gPolygonize and it worked, except for (as you predicted), if the edges meet the raster extents - but that definitely was an advance! I really appreciate your help and if you just point the way I can try to go after what needs to be done, but right now I?m stumped. best, Karla.
On Mon, Apr 4, 2016 at 5:38 PM, Michael Sumner <mdsumner at gmail.com> wrote:
Read the help for rasterToPolygons, alternatively try chaining rasterToContour and rgeos::gPolygonize. The latter may need coaxing if your edges meet the raster extents. Cheers, Mike On Tue, 5 Apr 2016, 05:32 Karla Shikev <karlashikev at gmail.com> wrote:
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]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Dr. Michael Sumner Software and Database Engineer Australian Antarctic Division 203 Channel Highway Kingston Tasmania 7050 Australia