Odd behavior with rasterToPolygons function in Raster package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Odd behavior with rasterToPolygons function in Raster package

R-sig-geo mailing list
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



_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

geo_coordinates.pdf (12K) Download Attachment
=?UTF-8?b?YWVhX3Byb2plY3RlZC5wZGY=?= (17K) Download Attachment