File: getKMLcoordinates.Rd

package info (click to toggle)
r-cran-maptools 1%3A1.0-2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,968 kB
  • sloc: ansic: 3,022; makefile: 5; sh: 4
file content (40 lines) | stat: -rw-r--r-- 1,435 bytes parent folder | download | duplicates (4)
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
\name{getKMLcoordinates}
\alias{getKMLcoordinates}

\title{Get a list of coordinates out of a KML file}

\description{
  This function parses a KML file to get the content of \code{<coordinates>} tags and returns a list of matrices representing the longitude-latitute or if \code{ignoreAltitude} is \code{FALSE} the longitude-latitute-altitude coordinates of a KML geometry.
}

\usage{
getKMLcoordinates(kmlfile, ignoreAltitude=FALSE)
}

\arguments{
  \item{kmlfile}{connection object or a character string of the KML file}
  \item{ignoreAltitude}{if set to \code{TRUE} the altitude values of a KML points will be ignored}
}

\value{
\code{coords} is a list of matrices representing the longitude-latitute or if \code{ignoreAltitude} is \code{FALSE} the longitude-latitute-altitude coordinates
}

\author{Hans-J. Bibiko}

\seealso{\code{\link{kmlPolygon}}, \code{\link{kmlLine}}}
\examples{
data(wrld_simpl)
## creates a KML file containing the polygons of South Africa (plus hole)
sw <- slot(wrld_simpl[wrld_simpl$NAME=="South Africa",], "polygons")[[1]]
tf <- tempfile()
kmlPolygon(sw, kmlfile=tf, name="South Africa", col="#df0000aa", lwd=5, 
    border=4, kmlname="R Test", 
    kmldescription="This is <b>only</b> a <a href='http://www.r-project.org'>R</a> test.")
zz <- getKMLcoordinates(tf, ignoreAltitude=TRUE)
str(zz)
zz <- getKMLcoordinates(system.file("shapes/Testing.kml", package="maptools"))
str(zz)
}
\keyword{spatial}