File: holepolys.Rd

package info (click to toggle)
r-cran-maptools 1%3A0.7-38-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 2,184 kB
  • sloc: ansic: 3,014; makefile: 4
file content (48 lines) | stat: -rw-r--r-- 1,340 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
\name{gpcholes}
\alias{gpcholes}
\alias{h1pl}
\alias{h2pl}

\docType{data}
\title{Hisaji Ono's lake/hole problem}
\description{
  How to plot polygons with holes - holes are encoded by coordinates going anticlockwise, and overplotting is avoided by re-ordering the order in which polygons are plotted.

This example is retained for historical interest only, other solutions are present in the sp package.
}
\usage{data(gpcholes)}

\details{

"Date: Tue, 11 May 2004 12:54:20 +0900
From: Hisaji ONO 
To: r-help

 I've tried to create a polygon with one hole by gpclib using following
example script.

 holepoly <- read.polyfile(system.file("poly-ex/hole-poly.txt", package="gpclib"), nohole = FALSE)
 area.poly(holepoly)
 plot(holepoly,poly.args=list(col="red",border="blue"))

 And I noticed plot function couldn't draw polygons with holes correctly.

 Does anyone know how to solve this situation?"

*(h1pl has reversed the y component of polygon 1, to make its ring direction clockwise, h2pl reverses the order of the two polygons in holepoly1@pts)*

}

\source{
  Data file included in "gpclib" package.
}

\examples{
data(gpcholes)
opar <- par(mfrow=c(1,2))
plot(SpatialPolygons(list(h2pl)), col="red", pbg="white", border="blue")
plot(SpatialPolygons(list(h1pl)), col="red", pbg="white", border="blue")
par(opar)
}

\keyword{datasets}