Learn R Programming

plotKML (version 0.2-4)

kml_open: Open / close a KML file connection

Description

Opens a KML file in write mode and initiates the KML header. The same file connection is further accessible by other kml_*() functions such as kml_layer() and kml_close(). kml_View tries to open the produced file using the default application.

Usage

kml_open(file.name, folder.name = file.name, kml_open = TRUE,
          kml_visibility = TRUE, overwrite = TRUE, use.Google_gx = FALSE, 
          kml_xsd = get("kml_xsd", envir = plotKML.opts),
          xmlns = get("kml_url", envir = plotKML.opts), 
          xmlns_gx = get("kml_gx", envir = plotKML.opts), ...)

Arguments

file.name
KML file name
folder.name
character string; KML folder name
kml_open
logical; specify whether to open the folder by default
kml_visibility
logical; specify whether to make the whole folder visible
overwrite
logical; if TRUE, "name" will be overwritten if it exists
use.Google_gx
logical; specify whether to use the Google's extended schema
kml_xsd
URL of the KML scheme to be used
xmlns
URL of the OGC KML standard
xmlns_gx
URL of the extended standard
...
other arguments

Details

These lower level functions can be used to create customized multi-layered KML files. See plotKML package homepage / manual for more examples.

See Also

kml-methods

Examples

Run this code
data(eberg_grid)
coordinates(eberg_grid) <- ~x+y
gridded(eberg_grid) <- TRUE
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
# Open, write layer and view KML file:
kml_open("eberg_grid_DEM.kml")
kml_layer(eberg_grid, colour=DEMSRT6)
kml_close("eberg_grid_DEM.kml")
# print the result:
xmlRoot(xmlTreeParse("eberg_grid_DEM.kml"))[["Document"]]
# open in Google Earth:
kml_View("eberg_grid_DEM.kml")

Run the code above in your browser using DataLab