Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
add single examples to all functions if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Mar 23, 2018
1 parent 2f651c7 commit f4b64fe
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 4 deletions.
3 changes: 1 addition & 2 deletions R/basemapLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ esriBasemapLabels <- list(
#' @param layerId Unique ID for the layer
#' @param group The group this layer belongs to.
#' @param options Basemap Layer Options. You can pass \code{\link[leaflet]{tileOptions}()}.
#' @examples \dontrun{
#' @examples
#' leaflet() %>%
#' addEsriBasemapLayer(esriBasemapLayers$Oceans, autoLabels = TRUE)
#' }
#' @export
addEsriBasemapLayer <- function(
map, key, autoLabels = FALSE,
Expand Down
18 changes: 18 additions & 0 deletions R/dynamicMapLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ dynamicMapLayerOptions <- function(
#' @param layerId A unique ID for the layer.
#' @param group The name of the group this layer should be added to.
#' @export
#' @examples
#' popupFunc <- htmlwidgets::JS(
#' "function (error, featureCollection) {
#' if (error || featureCollection.features.length === 0) {
#' return false;
#' } else {
#' return \"Risk Level: \" + featureCollection.features[0].properties.CLASS_DESC;
#' }
#' }")
#'
#' leaflet() %>% setView(-96.8, 38.5, 4) %>%
#' addEsriBasemapLayer(esriBasemapLayers$Gray, autoLabels = TRUE) %>%
#' addEsriDynamicMapLayer(
#' url = "https://maps7.arcgisonline.com/arcgis/rest/services/USDA_USFS_2014_Wildfire_Hazard_Potential/MapServer", popupFunction = popupFunc,
#' options = dynamicMapLayerOptions(useCors = FALSE))
#'
#' ## for more examples see
#' # browseURL(system.file("examples/dynamicMapLayers.R", package = "leaflet.esri"))
addEsriDynamicMapLayer <- function(
map, url,
options = dynamicMapLayerOptions(),
Expand Down
13 changes: 13 additions & 0 deletions R/featureLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ featureLayerOptions <- function(
#' @param fitBounds Whether to set the maps bounds to fit the data in the featureLayer
#' options
#' @export
#' @examples
#' leaflet() %>%
#' addEsriBasemapLayer(esriBasemapLayers$Streets) %>%
#' setView(-122.667, 45.526, 13) %>%
#' addEsriFeatureLayer(
#' url = "https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Heritage_Trees_Portland/FeatureServer/0",
#' useServiceSymbology = TRUE,
#' labelProperty = "COMMON_NAM", labelOptions = labelOptions(textsize = "12px"),
#' popupProperty = JS("function(feature) { return L.Util.template(\"<h3>{COMMON_NAM}</h3><hr /><p>This tree is located at {ADDRESS} and its scientific name is {SCIENTIFIC}.\", feature.properties);}"))
#'
#' ## for more examples see
#' # browseURL(system.file("examples/featureLayers.R", package = "leaflet.esri"))
#' # browseURL(system.file("examples/multipleFeatureLayers.R", package = "leaflet.esri"))
addEsriFeatureLayer <- function(
map, url, useServiceSymbology = FALSE,
options = featureLayerOptions(),
Expand Down
10 changes: 10 additions & 0 deletions R/imageMapLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ imageMapLayerOptions <- function(
#' @param layerId A unique ID for the layer.
#' @param group The name of the group this layer should be added to.
#' @export
#' @examples
#' leaflet() %>%
#' addEsriBasemapLayer(esriBasemapLayers$Gray) %>%
#' setView(30, 0, 3) %>%
#' addEsriImageMapLayer(
#' url = "https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/MODIS/ImageServer",
#' options = imageMapLayerOptions(useCors = FALSE))
#'
#' ## for more examples see
#' # browseURL(system.file("examples/imageMapLayers.R", package = "leaflet.esri"))
addEsriImageMapLayer <- function(
map, url,
options = imageMapLayerOptions(),
Expand Down
7 changes: 7 additions & 0 deletions R/tiledMapLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ tiledMapLayerOptions <- function(
#' @param layerId A unique ID for the layer.
#' @param group The name of the group this layer should be added to.
#' @export
#' @examples
#' leaflet() %>% setView(-81.47, 30.70, 12) %>%
#' addEsriTiledMapLayer(
#' url = "https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer")
#'
#' ## for more examples see
#' # browseURL(system.file("examples/tiledMapLayers.R", package = "leaflet.esri"))
addEsriTiledMapLayer <- function(
map, url,
options = tiledMapLayerOptions(),
Expand Down
2 changes: 0 additions & 2 deletions man/addEsriBasemapLayer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/addEsriDynamicMapLayer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/addEsriFeatureLayer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/addEsriImageMapLayer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/addEsriTiledMapLayer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4b64fe

Please sign in to comment.