addNetworkLinkControl | R Documentation |
Use this function to add control over how this kml will be fetched by other kml/kmz files. This is usually only needed if you plan on hosting this kml. Calling this function overwrites any previously created NetworkLink Controls
yourKMLobj$addNetworkLinkControl() #EMPTY networkLinkControl
yourKMLobj$addNetworkLinkControl(minRefreshPeriod, maxSessionLength, cookie, message, linkName, linkDescription, linkSnippet, expires, update, AbstractView)
minRefreshPeriod |
numeric, seconds that need to pass before this kml can be fetched again. Helps throtle network. |
maxSessionLength |
numeric, seconds to keep the kml linked. A value of -1 means remain open indefinitly. (Default: -1) |
cookie |
character. text appended to the URL query on the next refresh of the network link. This is usefull whenlinking to cgi scripts that can use conditional file delivery. |
message |
character. If specified, a pop-up will apear when a client links to this kml with the contents of the text. |
linkName |
character. Define the name of the networkLink which will appear in the client's file tree. |
linkDescription |
character. Define a description for this link that will appear in the client's file tree. |
linkSnippet |
character. Define more information about this link in addition to linkDescription. |
expires |
character. date/time (formats: (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss) at which the link should be refreshed. This specification is used only when the the client kml has Link argument refreshMode = 'onExpire'. |
update |
character. xml text specifing a previously loaded kml and actions change, create or delete. The is for advanced users only. See KML networkLinkControll under References for a good description |
AbstractView |
character. Reference to the id of an Abstract view that has already been created or will soon be created. This is where the clients camera will go when this kml is linked. |
Brent Cameron
Department of Fisheries and Oceans Canada
Population Ecology Division
KML networkLinkControll Reference Network Link Aditional Info
## Changes view after 20 seconds
#Create the hosted kml
hostkml = RKmlObject()
#add an Astract view
hostkml$addAbstractView(type = "lookat", viewid = "sable_view", latitude = 43.9, longitude = -59.9, range = 100000)
hostkml$addNetworkLinkControl(minRefreshPeriod = 20, maxSessionLength = 60, message = "Welcome to the example Network Control kml. This kml will only stay linked for 60 seconds", linkName = "Sable Island", linkDescription = "You will soon fly to St.Paul's Island", linkSnippet = "buckle your seatbelt", AbstractView = "sable_view")
#hostkml$writekml("hostkml.kml")
#Create a client kml
clientkml = RKmlObject()
#kml client will attempt to refresh every second but will fail due to hosts minRefreshPeriod
clientkml$addNetworkLink(href = "hostkml.kml",flyToView = 1, refreshMode = "onInterval", refreshInterval = 1)
#clientkml$preview()
#Change the abstract view, should update in the preview of the clientkml after 20 seconds from the clientkml #linking to the host kml
hostkml$addAbstractView(type = "lookat", viewid = "stPaulsView", latitude = 47.2, longitude = -60.15, range = 10000)
hostkml$addNetworkLinkControl(minRefreshPeriod = 20, maxSessionLength = 60, message = "Welcome to the example Network Control kml. This kml will only stay linked for 60 seconds", linkName = "St.Paul's Island", linkDescription = "The link will expire in 40 seconds", linkSnippet = "watch your step", AbstractView = "stPaulsView")
#hostkml$writekml("hostkml.kml")
### End Example ###
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.