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

Roger Bivand Roger.Bivand at nhh.no
Mon Aug 25 11:22:45 CEST 2014


On Mon, 25 Aug 2014, frankma wrote:

> Hi,
>
> I'm having the same issue. Did you manage to solve this?

Please always quote the problem verbatim, providing a reproducible 
example. Even if anyone cares to open nabble to find the link, nobody can 
actually know whether your problem is the same. The reason we ask for 
reproducible examples is that the effort needed by the questioner to 
create a reproducible example means that he/she has to look more closely 
at - here "I’m following a tutorial found in the web" - what they are 
trying to do, and very often see their mistake themselves. Learning to 
debug one's own work is not easy, takes time, but wastes less of other 
peoples' time than asking lazy questions - see the posting guide:

http://www.r-project.org/posting-guide.html

It is also very helpful to see an affiliation, so that anyone caring to 
answer knows where to start. This is especially important when the 
sender's address is non-institutional.

In the original question:

https://stat.ethz.ch/pipermail/r-sig-geo/2014-April/020764.html

the obvious error was to think that the PolySet class in PBSmapping 
understands other projections than UTM:

# library(maptools)
# zm.* not available
> 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)
> attr(zmprojPS, "projection") <- "LL"

I assume that no answer was posted because the error message was totally 
obvious, that is that lcc is Lambert conformal conic, but LL is the code 
for geographical, unprojected, coordinates, so PBSmapping could not 
project to UTM to calculate areas as:

"the mean longitude falls outside the range -180 < x <= 180."

If you are also mixing up projections, then this also explains what you 
are seeing.

Hope this clarifies,

Roger

>
> Thanks,
> Matt
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Error-message-when-dissolving-polygons-tp7586109p7586979.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list