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

Michael Sumner mdsumner at gmail.com
Mon Apr 4 22:38:01 CEST 2016


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

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list