addScreenOverlay: Add a Screen Overlay to kml

addScreenOverlayR Documentation

Add a Screen Overlay to kml

Description

Add a screen overlay to a kml object. This will be usefull when adding titles or legends to your kml.

Usage

addScreenOverlay(fn = pathtogeoimage)
addGroundOverlay(fn = pathtoimage, overlay_x, overlay_xunit, overlay_y, overlay_yunit, screen_x, screen_Y)

Arguments

fn

Mandatory. Specify the path to the image.

overlay_x

numeric. Set the x axis anchor position on the image. 0.0 - 1.0 for 'fraction' units, 1 - max(x resolution) for 'pixel' or 'insetpixel' units. (Default: .5)

overlay_y

numeric. Set the x axis anchor position on the image. 0.0 - 1.0 for 'fraction' units, 1 - max(x resolution) for 'pixel' or 'insetpixel' units. (Default: .5)

overlay_xunit

character. One of 'fraction', 'pixels' or 'insetpixels'. Set the units for the overlay_x argument. (Default: 'fraction')

overlay_yunit

character. One of 'fraction', 'pixels' or 'insetpixels'. Set the units for the overlay_y argument. (Default: 'fraction')

screen_x

numeric. Set the x axis anchor position on the screen. 0.0 - 1.0 for 'fraction' units, 1 - max(x resolution) for 'pixel' or 'insetpixel' units. (Default: .5)

screen_y

numeric. Set the x axis anchor position on the screen. 0.0 - 1.0 for 'fraction' units, 1 - max(x resolution) for 'pixel' or 'insetpixel' units. (Default: .5)

screen_xunit

character. One of 'fraction', 'pixels' or 'insetpixels'. Set the units for the screen_x argument. (Default: 'fraction')

screen_yunit

character. One of 'fraction', 'pixels' or 'insetpixels'. Set the units for the screen_y argument. (Default: 'fraction')

rotation_x

numeric. Set the x axis screen position about which the image will be rotated. 0.0 - 1.0 for 'fraction' units, 1 - max(x resolution) for 'pixel' or 'insetpixel' units. (Default: .5)

rotation_y

numeric. Set the y axis screen position about which the image will be rotated. 0.0 - 1.0 for 'fraction' units, 1 - max(x resolution) for 'pixel' or 'insetpixel' units. (Default: .5)

rotation_xunit

character. One of 'fraction', 'pixels' or 'insetpixels'. Set the units for the rotation_x argument. (Default: 'fraction')

rotation_yunit

character. One of 'fraction', 'pixels' or 'insetpixels'. Set the units for the rotation_y argument. (Default: 'fraction')

size_x

numeric. Set the size of the image along the x axis. 0.0 - 1.0 for 'fraction' units, 1 - n for 'pixel' units. (Default: 1)

size_y

numeric. Set the size of the image along the y axis. 0.0 - 1.0 for 'fraction' units, 1 - n for 'pixel' units. (Default: 1)

size_xunit

character. One of 'fraction' or 'pixels'. Set the units for the size_x argument. (Default: 'fraction')

size_yunit

character. One of 'fraction' or 'pixels'. Set the units for the size_y argument. (Default: 'fraction')

drawOrder

numeric, set the order of the image rendering. (Default:NULL)

color

Specify a color to blend with the image. This can be one of the predefined colors(), color as hex, or color as rgb object. (Default: NULL)

transparency

numeric. Set the transparency for the color. 0.0 - 1.0, fully opaque:0, solid:1. (Default: 1)

rotation

numeric. Set the transparency for the color. 0.0 - 1.0, fully opaque:0, solid:1. (Default: 1)

altitude

numeric, meters above/below altiudeMode. 'clamp' altitudeModes ignore altitude. (Default: 0)

altitudeMode

one of "clampToGround", "relativeToGround", "absolute", "clampToSeaFloor", "relativeToSeaFloor". (Default:"clampToGround")

name

Character string or NULL. What the feature will be called in the graphics environment. (Default:NULL)

visibility

Boolean (0-invisible or 1-visible). Specify if the feature will be visible. (Default: 1)

open

Boolean (0-closed or 1-open). Specify if the feature is open or closed in the kml object tree. (Default: 0)

atomauthor

Character string or NULL. Text identifying an author relevant to the topic. See Ascription Elements under References (Default: NULL)

atomlinkhref

Character string or NULL. Text identifying a web link relevant to the topic. See Ascription Elements under References (Default: NULL)

address

Character string or NULL. Specify an unstructured address that is associated with the overlay. (Default:NULL)

xalAddressDetails

Character string or NULL. Specify an structured address in eXtensible Address Language(See xal:AddressDetails under References) that is associated with the overlay. (Default:NULL)

phoneNumber

Character string or NULL. Text identifying a phone number, useful for mobile apps. (Default:NULL)

Snippet

Character string or NULL. Supply details in addition to description. (Default:NULL)

description

Character string or NULL. Supply details, may contain CDATA. See NOTES section for more info. (Default:NULL)

AbstractView

Character string or NULL. The id of the desired AbstractView. Must create AbstractView with addAbstractView() function. (Default:NULL)

TimeStamp

Character string of date-time in one of the following formats: (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss). Used to create kml timeseries. (Default:NULL)

TimeSpanStart

Character string of date-time in one of the following formats(overides TimeStamp): (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss). Used to create timeseries. (Default:NULL)

TimeSpanEnd

Character string of date-time in one of the following formats(overrides TimeStamp): (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss). Used to create timeseries. (Default:NULL)

styleUrl

Character string or NULL. The id of the desired Style. Must create a style with one of the addStyle() or interactiveStyle() functions. (Default:NULL)

Region

Currently not supported

ExtendedData

Currently not supported

inFolder

Allows the adding of data to a specified folder, (EXPERIMENTAL) Usage: inFolder = 'this\that'

Note

description
For advanced description arguments, wrap html in CDATA tags. You can use packages to build html such as R2HTML(uses headers that are not required by CDATA) or, if you are comfortable with html, just add your html text inside CDATA enclosures.
text = ''<!\[CDATA\[
<b><font color="#CC0000" size='+3'>Example Text</font></b>
<br/><br/>
<font face='Courier'>Example Text</font>
]]>''

See also: Description Example

Author(s)

Brent Cameron
Department of Fisheries and Oceans Canada
Population Ecology Division

References

KML screenoverlay Reference
Ascription Elements
xal:AddressDetails

Examples

png(filename="figure.png", height=200, width=300, 
    bg="transparent")
plot(1, type="n", axes=FALSE, xlab="", ylab="")
legend(1, 1, legend = c("Hello", "World"), col=1:2, lwd=2, cex=3, xjust=0.5, yjust=0.5)
dev.off()
mykml = RKmlObject()
fn = file.path(getwd(), "figure.png")
mykml$addScreenOverlay(fn, size_x = .2, size_y = .2)

#mykml$preview()


brent0/kmlbuilder documentation built on Feb. 2, 2024, 2:05 a.m.