EVOLUTION-MANAGER
Edit File: addLayersControl.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Add UI controls to switch layers on and off</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for addLayersControl {leaflet}"><tr><td>addLayersControl {leaflet}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Add UI controls to switch layers on and off</h2> <h3>Description</h3> <p>Uses Leaflet's built-in <a href="http://leafletjs.com/reference-1.3.1.html#control-layers">layers control</a> feature to allow users to choose one of several base layers, and to choose any number of overlay layers to view. </p> <h3>Usage</h3> <pre> addLayersControl(map, baseGroups = character(0), overlayGroups = character(0), position = c("topright", "bottomright", "bottomleft", "topleft"), options = layersControlOptions(), data = getMapData(map)) layersControlOptions(collapsed = TRUE, autoZIndex = TRUE, ...) removeLayersControl(map) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>map</code></td> <td> <p>the map to add the layers control to</p> </td></tr> <tr valign="top"><td><code>baseGroups</code></td> <td> <p>character vector where each element is the name of a group. The user will be able to choose one base group (only) at a time. This is most commonly used for mostly-opaque tile layers.</p> </td></tr> <tr valign="top"><td><code>overlayGroups</code></td> <td> <p>character vector where each element is the name of a group. The user can turn each overlay group on or off independently.</p> </td></tr> <tr valign="top"><td><code>position</code></td> <td> <p>position of control: "topleft", "topright", "bottomleft", or "bottomright"</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>a list of additional options, intended to be provided by a call to <code>layersControlOptions</code></p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>the data object from which the argument values are derived; by default, it is the <code>data</code> object provided to <code>leaflet()</code> initially, but can be overridden</p> </td></tr> <tr valign="top"><td><code>collapsed</code></td> <td> <p>if <code>TRUE</code> (the default), the layers control will be rendered as an icon that expands when hovered over. Set to <code>FALSE</code> to have the layers control always appear in its expanded state.</p> </td></tr> <tr valign="top"><td><code>autoZIndex</code></td> <td> <p>if <code>TRUE</code>, the control will automatically maintain the z-order of its various groups as overlays are switched on and off.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>other options for <code>layersControlOptions()</code></p> </td></tr> </table> <h3>Examples</h3> <pre> leaflet() %>% addTiles(group = "OpenStreetMap") %>% addProviderTiles("Stamen.Toner", group = "Toner by Stamen") %>% addMarkers(runif(20, -75, -74), runif(20, 41, 42), group = "Markers") %>% addLayersControl( baseGroups = c("OpenStreetMap", "Toner by Stamen"), overlayGroups = c("Markers") ) </pre> <hr /><div style="text-align: center;">[Package <em>leaflet</em> version 2.0.3 <a href="00Index.html">Index</a>]</div> </body></html>