Learn R Programming

plotKML (version 0.5-4)

kml_screen: Add a screen overlay

Description

Adds an image file (map legend or logo) as screen overlay. The same file connection is further accessible by other kml_*() functions such as kml_layer() and kml_close(). This allows creation of customized multi-layered KML files.

Usage

kml_screen(image.file, sname = "", 
     position = c("UL","ML","LL","BC","LR","MR","UR","TC")[1],
     overlayXY, screenXY, xyunits = c("fraction", "pixels", "insetPixels")[1], 
     rotation = 0, size = c(0,0) )

Arguments

image.file
image file to be used for screen overlay
sname
screen overlay name
position
one of the nine standard positions
overlayXY
manually specified tie point on the overlay image e.g. 'x="0" y="1"'
screenXY
manually specified matching tie point on the scren e.g. 'x="0" y="1"'
xyunits
values of the XY units (("pixels", "fraction", or "insetPixels")
rotation
(optional) rotation in degrees clock-wise
size
size correction in x and y direction

Details

If nothing else is specified the function looks for some of the nine typical positions: "UL" (upper left), "ML" (middle left), "LL" (lower left), "BC" (bottom centre), "LR" (lower right), "MR" (middle right), "UR" (upper right), and "TC" (top centre). The x and y values can be specified in three different ways: as pixels ("pixels"), as fractions of the image ("fraction"), or as inset pixels ("insetPixels") --- an offset in pixels from the upper right corner of the image.

References

  • KML Reference (http://code.google.com/apis/kml/documentation/)

See Also

kml-methods

Examples

Run this code
library(rgdal)
library(sp)
data(eberg_zones)
# add logo in the top-center:
kml_open("eberg_screen.kml")
kml_layer(eberg_zones)
logo = "http://meta.isric.org/images/ISRIC_right.png"
kml_screen(image.file = logo, position = "TC", sname = "ISRIC logo")
kml_close("eberg_screen.kml")
kml_compress("eberg_screen.kml")

Run the code above in your browser using DataLab