[R-sig-Geo] gUnaryUnion does not work on my SpatialPolygonsDataFrame?
Ulrike Grömping
groemping at beuth-hochschule.de
Wed Jul 8 20:57:02 CEST 2015
Dear R-sig-Geos,
I am quite new to geographical data in R and also to shape files etc.,
and I have encountered the following difficulty: After reading a
publicly available shape file on recent EU elections in Berlin (link
https://www.statistik-berlin-brandenburg.de/opendata/RBS_OD_STI_EU1405.zip)
with the ReadShapePoly command, it contains the Berlin EU election
"Stimmbezirke" (variable STI), as expected, and they can be plotted.
When using the gUnaryUnion or the gUnionCascaded function from rgeos for
uniting several "Stimmbezirke" into the larger postal voting units
(variable BRFW), the result is one single polygon instead of the
expected 529 such units; plotting it shows a shape that does not explain
itself to me.
BW_EU <- readShapePoly("RBS_OD_STI_EU1405.shp") ## shape directory is
working directory
plot(BW_EU) ## plots the expected "Stimmbezirke"
BW_EU_BRFW <- gUnionCascaded(BW_EU, "BRFW") ## gUnaryUnion does not
make a difference
plot(BW_EU_BRFW) ## plots only a single outline
I then tried to use gUnaryUnion with the variable STI (which I expected
to return the unchanged polygons), which apparently returned exactly the
same outline as the one obtained with BRFW. Presumable, I am overlooking
something basic here, but I fail to see what. Can someone help?
Thanks in advance!
Best, Ulrike
--
##############################################
## Prof. Ulrike Groemping
## FB II
## Beuth University of Applied Sciences Berlin
##############################################
## prof.beuth-hochschule.de/groemping
## Phone: +49(0)30 4504 5127
## Fax: +49(0)30 4504 66 5127
## Home office: +49(0)30 394 04 863
##############################################
More information about the R-sig-Geo
mailing list