getKMLcoordinates

0th

Percentile

Get a list of coordinates out of a KML file

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

Keywords
spatial
Usage
coords <- getKMLcoordinates(kmlfile, ignoreAltitude=FALSE)
Arguments
kmlfile
connection object or a character string of the KML file
ignoreAltitude
if set to TRUE the altitude values of a KML points will be ignored
Value

  • coords is a list of matrices representing the longitude-latitute or if ignoreAltitude is FALSE the longitude-latitute-altitude coordinates

See Also

kmlPolygon, kmlLine

Aliases
  • getKMLcoordinates
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)
Documentation reproduced from package maptools, version 0.7-22, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.