[R-sig-Geo] Merging spatial polygons

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 14 09:49:23 CEST 2013


On Thu, 13 Jun 2013, John Tomkinson wrote:

> Hi,
>
> I'm looking to merge spatial polygons within a spatial polygon object. I 
> used to do this with the union spatial polygons command :
>
> neighbourhoods<-unionSpatialPolygons(city, neighbourhood$ID, 
> threshold=NULL, avoidGEOS=FALSE, avoidUnaryUnion=FALSE)
>
> But now having gpclib issues, my question is how would I do this with 
> the rgeos package? I can't seem to get the gUnion function to work.

If rgeos is available, unionSpatialPolygons() will use that rather than 
gpclib, so actually runs: gUnaryUnion(spgeom=city, 
id=as.character(neighbourhood$ID)) in your case. What does rgeosStatus() 
say with maptools loaded?

Always provide full details of error messages, best a reproducible example 
with a built-in data set, and always the output of sessionInfo().

>
> Thanks in advance,
>
> John
>
> 	[[alternative HTML version deleted]]

Only post plain text!

Roger

>
> _______________________________________________
> 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, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list