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.
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) )
image file to be used for screen overlay
screen overlay name
one of the nine standard positions
manually specified tie point on the overlay image e.g. 'x="0" y="1"'
manually specified matching tie point on the scren e.g. 'x="0" y="1"'
values of the XY units (("pixels"
, "fraction"
, or "insetPixels"
)
(optional) rotation in degrees clock-wise
size correction in x and y direction
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.
KML Reference (https://developers.google.com/kml/documentation/?csw=1)
# NOT RUN {
library(rgdal)
library(sp)
data(eberg_zones)
# }
# NOT RUN {
# 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