Problem with SpatialPolygons containing a hole
On Thu, Jan 29, 2009 at 10:51, Roger Bivand <Roger.Bivand at nhh.no> wrote:
On Thu, 29 Jan 2009, Hans-J?rg Bibiko wrote:
On 29.01.2009, at 13:08, Roger Bivand wrote:
Set the pbg= argument to set the "bg" (background) to something other than "transparent" - if it is transparent, the previously plotted larger and encompassing polygon is still visible. I'm afraid that the documentation, which should be in ?"SpatialPolygons-class" where the plot method is described, is in the maptools package, in ?plot.polylist - this will be fixed.
Thanks. plot(pseSP,col='red', pbg='white') works. But this also implies that: - one is not able to create a transparent hole(?)
No. By assumption, a hole is smaller than the enclosing polygon surrounding it. Both are "Polygon" objects in a "Polygons" object, and these are plotted from largest to smallest. So if a hole is transparent, you will see the polygon lying underneath and around it, so won't see the hole. "Polygon" objects are simply rings of coordinates, not topological structures.
- and one has to care about the correct plotting order or to set the correct pbg if that 'hole' belongs to another polygon
By assumption, "Polygon" objects that are holes should only be within another "Polygon" object belonging to the same "Polygons" object. It is possible that data in the wild do not follow this structure, though it is hard to think of a real case of a hole (say lake) belonging to one county, but lying in a different county.
That surely goes in Bolivia. Everything goes in Bolivia. Kjetil
Roger
Cheers, --Hans
_______________________________________________ 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
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
"Mathematics is not the rigid and rigidity-producing schema that the
layman thinks it is; rather, in it we find ourselves at that meeting
point of constraint and freedom that is the very essence of human
nature."
- Hermann Weyl