[R-sig-Geo] Error message when dissolving polygons

Rolando Valdez rvaldezr at gmail.com
Wed Apr 2 07:02:10 CEST 2014


Hi,

I’m trying to dissolve a polygon with 345 municipalities in 56 metropolitan areas. I’m following a tutorial found in the web, now I’m stuck in a step, I got an error message:

> input = readShapePoly("zm.shp", proj4string=CRS("+proj=lcc +ellps=GRS80 +datum=WGS84"))
> projectedpolygons = spTransform(input, CRS("+proj=lcc +ellps=GRS80 +datum=WGS84"))
> zmprojPS = SpatialPolygons2PolySet(projectedpolygons)
> plotPolys(zmprojPS, proj=TRUE, col="wheat1", xlab="longitude", ylab="latitude")
> print("Calculating polygon areas...")
[1] "Calculating polygon areas..."
> attr(zmprojPS, "projection")
[1] "1"
> attr(zmprojPS, "projection") <- "LL"
> zmPolyAreas = calcArea(zmprojPS, rollup=1)
Error in calcArea(zmprojPS, rollup = 1) : 
  To calculate the areas of polygons defined by longitude-latitude
coordinates, this routine first projects them in UTM.

Attempted to automatically calculate the missing 'zone' attribute, but
that failed because the mean longitude falls outside the range
-180 < x <= 180.

How I can solve this issue?

Thanks in advance,

Rolando Valdez



More information about the R-sig-Geo mailing list