[R-sig-Geo] UnionSpatialPolygons in the German DEU_adm3.RData file

DPajak pajak at europa-uni.de
Mon Jan 31 00:26:31 CET 2011


Hello,

actually I started to learn how to produce a choropleth map today. So
hopefully somebody can help me?

I want to use the GADM data file for Germany (DEU_adm3.RData) along with
some data from my dissertation in business studies. So far so good. Since
there are some good examples out there it was easy to merge those two files.

The problem I have is due to some local government reorganizations (e.g. the
Kreisgebietsreform 2008 in Saxony).

So I have to merge some district in the DEU_adm3.RData file. 

I learnt today, that the "UnionSpatialPolygons" of the GPC library can do
that. 

So I tried to figured out, how to use this function. Here is what I have so
far:

---
library(sp)
library(maptools)
library(gpclib) #
http://en.wikipedia.org/wiki/GPC_General_Polygon_Clipper_Library
gpclibPermit() 
Germany <-load("./Dropbox/Projekte/Spatial Map/DEU_adm3.RData")

write.csv(gadm, "gadm-data.csv")

# ID_3 for the three former districts Döbeln (23204), Freiberg (23185) &
Mittweida (23187)

Merge_Mittelsachsen <- gadm[gadm$ID_3 %in% c("23185","23187","23204"),]
ID <- rep("Mittelsachsen", length(slot(Merge_Mittelsachsen, "polygons")))
Mittelsachsen <- unionSpatialPolygons(Merge_Mittelsachsen, ID)
plot(Mittelsachsen)
---

This works perfectly to plot the new district of Mittelsachsen
(Middle-Saxony). 

But how can I combine this new merged district with the rest of the German
map? Or in others words, how can I overwrite the former three separated
districts with my new "Mittelsachsen" polygon.

Thank you very much for any hints you can give me.

Danny Pajak




-- 
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/UnionSpatialPolygons-in-the-German-DEU-adm3-RData-file-tp5975724p5975724.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list