Skip to content
Back to formatted view

Raw Message

Message-ID: <CAPU4_4pURuP2Zq_o_oW3E7bPOi9Chxmc=HwsdrWaDOYRc30W6g@mail.gmail.com>
Date: 2016-04-04T19:32:26Z
From: Karla Shikev
Subject: problem with rasterToPolygons x worldclim

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]]