The function is used to create and write a KML file on the basis of a given Lines object (a list of Line objects) for the usage in Google Earth and Google Maps.
kmlLines(obj=NULL, kmlfile=NULL, name="R Lines", description="", col=NULL, visibility=1, lwd=1, kmlname="", kmldescription="")
the name of the KML line
the description of the KML line (HTML tags allowed)
the stroke color (see also Color Specification) of the KML line
if set to
the stroke width for the KML line
the name of the KML layer
the description of the KML layer (HTML tags allowed)
The function is used to convert a given
Lines object (a list of Line objects) or the first
Lines object listed in a passed
SpatialLinesDataFrame object into KML line(s). If
kmlfile is not
NULL the result will be written into that file. If
NULL the generated KML lines will be returned (see also value). Function no longer uses
append greatly improving performance on large objects or lists.
For a passed
Lines object the function generates a <Style> tag whereby its id attribute is set to the passed object's ID.
Note that the geometries should be in geographical coordinates with datum WGS84.
The resulting KML line will be embedded in
x is a list with the elements
content containing the generated lines of the KML file as character vectors if
y is a list with the elements
footer representing the KML file header and footer if
The following color specifications are allowed:
2, or as hex code
'#RRGGBBAA' for passing the alpha value.
Hans-J. Bibiko, Jon Callahan, Steven Brey
# Maptools library required library(maptools) # load line object rivers <- readShapeSpatial(system.file("shapes/fylk-val-ll.shp", package="maptools"), proj4string=CRS("+proj=longlat +ellps=WGS84"))#> Warning: readShapeSpatial is deprecated; use rgdal::readOGR or sf::st_read#> Warning: readShapeLines is deprecated; use rgdal::readOGR or sf::st_read