[R-sig-Geo] Odd behavior with rasterToPolygons function in Raster package

Julie Lee-Yaw julleeyaw at yahoo.ca
Fri Apr 20 19:47:51 CEST 2018


Hello,
I've got a raster with values 1 and NA. I'm attempting to convert to a polygon using the rasterToPolygons function with dissolve=TRUE. The raster is in an equal area projection (+proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs )
When I use this command on the projected raster:
sh<-rasterToPolygons(myraster,dissolve=TRUE)
I get a SpatialPolygonsDataFrame with a single polygon but this plots several lines in the polygon (dissolve function partially working but not plotting as a simple perimeter of the polygon).
If I project the raster to a geographic coordinate system ("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"), I get the expected plot.
Both plots are attached.
I would appreciate any insight. This is part of a larger script and the projected raster/polygon is desirable.
Thanks


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20180420/5a5ca18c/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: geo_coordinates.pdf
Type: application/pdf
Size: 9030 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20180420/5a5ca18c/attachment.pdf>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aea_projected.pdf
Type: application/pdf
Size: 13452 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20180420/5a5ca18c/attachment-0001.pdf>


More information about the R-sig-Geo mailing list