From ab61d68b54566eac1f6d64c06b1c368f053e4ec8 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 27 Mar 2018 17:37:40 -0400 Subject: [PATCH] fix examples prematurely changed for useCors = FALSE --- R/dynamicMapLayers.R | 3 +-- R/imageMapLayers.R | 8 ++++---- inst/examples/dynamicMapLayers.R | 6 ++---- inst/examples/imageMapLayers.R | 5 +++-- man/addEsriDynamicMapLayer.Rd | 3 +-- man/addEsriImageMapLayer.Rd | 8 ++++---- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/R/dynamicMapLayers.R b/R/dynamicMapLayers.R index bc7bf19..a5058dc 100644 --- a/R/dynamicMapLayers.R +++ b/R/dynamicMapLayers.R @@ -86,8 +86,7 @@ dynamicMapLayerOptions <- function( #' addEsriDynamicMapLayer( #' url = paste0("https://maps7.arcgisonline.com/arcgis/rest/services/", #' "USDA_USFS_2014_Wildfire_Hazard_Potential/MapServer"), -#' popupFunction = popupFunc, -#' options = dynamicMapLayerOptions(useCors = FALSE)) +#' popupFunction = popupFunc) #' #' ## for more examples see #' # browseURL(system.file("examples/dynamicMapLayers.R", package = "leaflet.esri")) diff --git a/R/imageMapLayers.R b/R/imageMapLayers.R index 9aadcbe..31eded0 100644 --- a/R/imageMapLayers.R +++ b/R/imageMapLayers.R @@ -82,11 +82,11 @@ imageMapLayerOptions <- function( #' @export #' @examples #' leaflet() %>% -#' addEsriBasemapLayer(esriBasemapLayers$Gray) %>% -#' setView(30, 0, 3) %>% +#' addEsriBasemapLayer(esriBasemapLayers$Imagery) %>% +#' setView(-120.23, 43.5, 5) %>% #' addEsriImageMapLayer( -#' url = "https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/MODIS/ImageServer", -#' options = imageMapLayerOptions(useCors = FALSE)) +#' url = "http://imagery.oregonexplorer.info/arcgis/rest/services/NAIP_2011/NAIP_2011_Dynamic/ImageServer", +#' options = imageMapLayerOptions(bandIds = c(3, 0, 1))) #' #' ## for more examples see #' # browseURL(system.file("examples/imageMapLayers.R", package = "leaflet.esri")) diff --git a/inst/examples/dynamicMapLayers.R b/inst/examples/dynamicMapLayers.R index e3ba546..f06176e 100644 --- a/inst/examples/dynamicMapLayers.R +++ b/inst/examples/dynamicMapLayers.R @@ -15,8 +15,7 @@ leaflet() %>% setView(-99.88, 37.71, 4) %>% layerId = "selectedFeatures", position = "bottomleft") %>% addEsriDynamicMapLayer( url = "https://services.arcgisonline.com/arcgis/rest/services/Specialty/Soil_Survey_Map/MapServer", - layerId = "soil", - options = dynamicMapLayerOptions(useCors = FALSE)) %>% + layerId = "soil") %>% htmlwidgets::onRender(htmlwidgets::JS( "function(el, x, data) { var map = this; @@ -62,5 +61,4 @@ popupFunc <- htmlwidgets::JS( 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)) + url = "https://maps7.arcgisonline.com/arcgis/rest/services/USDA_USFS_2014_Wildfire_Hazard_Potential/MapServer", popupFunction = popupFunc) diff --git a/inst/examples/imageMapLayers.R b/inst/examples/imageMapLayers.R index 25affff..cd144f8 100644 --- a/inst/examples/imageMapLayers.R +++ b/inst/examples/imageMapLayers.R @@ -6,6 +6,8 @@ library(leaflet.esri) #' ### Examples 1 & 2 +#' Simple examples. In Example 1 we need to disable CORS as the ArcGIS ver. is old and doesn't support cors.

+ leaflet() %>% addEsriBasemapLayer(esriBasemapLayers$Gray) %>% @@ -20,8 +22,7 @@ leaflet() %>% addEsriBasemapLayer(esriBasemapLayers$Gray) %>% setView(-96.8, 38.5, 4) %>% addEsriImageMapLayer( - url = "https://seamlessrnc.nauticalcharts.noaa.gov/arcgis/rest/services/RNC/NOAA_RNC/ImageServer", - options = imageMapLayerOptions(useCors = FALSE)) + url = "https://seamlessrnc.nauticalcharts.noaa.gov/arcgis/rest/services/RNC/NOAA_RNC/ImageServer") #' ### Example 3 #' Custom band Ids for infrared image layer.

diff --git a/man/addEsriDynamicMapLayer.Rd b/man/addEsriDynamicMapLayer.Rd index dbdd52a..621717c 100644 --- a/man/addEsriDynamicMapLayer.Rd +++ b/man/addEsriDynamicMapLayer.Rd @@ -48,8 +48,7 @@ leaflet() \%>\% setView(-96.8, 38.5, 4) \%>\% addEsriDynamicMapLayer( url = paste0("https://maps7.arcgisonline.com/arcgis/rest/services/", "USDA_USFS_2014_Wildfire_Hazard_Potential/MapServer"), - popupFunction = popupFunc, - options = dynamicMapLayerOptions(useCors = FALSE)) + popupFunction = popupFunc) ## for more examples see # browseURL(system.file("examples/dynamicMapLayers.R", package = "leaflet.esri")) diff --git a/man/addEsriImageMapLayer.Rd b/man/addEsriImageMapLayer.Rd index eb123c6..010b3f2 100644 --- a/man/addEsriImageMapLayer.Rd +++ b/man/addEsriImageMapLayer.Rd @@ -32,11 +32,11 @@ Image Services provide access to raster data through a web service. } \examples{ leaflet() \%>\% - addEsriBasemapLayer(esriBasemapLayers$Gray) \%>\% - setView(30, 0, 3) \%>\% + addEsriBasemapLayer(esriBasemapLayers$Imagery) \%>\% + setView(-120.23, 43.5, 5) \%>\% addEsriImageMapLayer( - url = "https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/MODIS/ImageServer", - options = imageMapLayerOptions(useCors = FALSE)) + url = "http://imagery.oregonexplorer.info/arcgis/rest/services/NAIP_2011/NAIP_2011_Dynamic/ImageServer", + options = imageMapLayerOptions(bandIds = c(3, 0, 1))) ## for more examples see # browseURL(system.file("examples/imageMapLayers.R", package = "leaflet.esri"))