[R-sig-Geo] Best way to merge selected regions in a map?

Roger Bivand Roger.Bivand at nhh.no
Fri Nov 10 18:04:10 CET 2006

On Fri, 10 Nov 2006, Frosch, Katharina wrote:

> Dear all, 
> I work with a county map of Germany and have to merge 100 out of 440
> counties in total. I tried several ways, using unionSpatialPolygons from
> the spgpc package and combine union and append commands from the gpclib
> package, but did not succeed. What is the best and most "elegant" way to
> do the merging? Especially: Which objects do I have to use (+ how to
> keep and to retrieve the ID of the counties without mixing it up). 
> Either I do not manage to choose the respective two counties to merge,
> or the commands do not correspond to the object I saved the two counties
> in. I start with a MIF/MID file of Europe, which I load into R and then
> save using writePolyShape. 

Please include some of the commands you have used. In principle 
unionSpatialPolygons() should work, given that the classifying factor has 

length(unique(factor)) < length(factor)

and the boundaries of the polygons are the same. If the boundaries are 
separated, for example by a river, the output Polygons object will be 
joined, but will be represented by two distinct Polygon objects.

So there are two possible reasons for the dissolve not working.

More advice on the arguments to the function will be easier to give if you 
paste the ones you used into your posting.


> Any explanation how to proceed in general would be great. If this kind
> of question is not very specific and is covered, more or less, in any
> manual, I'd appreciate the link as I guess that I am lacking also some
> basics (and the documentation . 
> Thanks in advance
> Katharina
> Katharina Frosch
> Rostocker Zentrum
> Konrad-Zuse-Str. 1
> 18057 Rostock
> Tel.: (0381) 2081-148
> Fax: (0381) 2081-448
> Mail: frosch at rostockerzentrum.de 
> ----------
> This mail has been sent through the MPI for Demographic Rese...{{dropped}}
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, 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