diff --git a/.lintr b/.lintr
new file mode 100644
index 0000000..47206f6
--- /dev/null
+++ b/.lintr
@@ -0,0 +1,6 @@
+linters: with_defaults(
+ camel_case_linter = NULL, # 122
+ line_length_linter = NULL, # 33
+ commented_code_linter = NULL, # 3
+ NULL
+ )
diff --git a/R/basemapLayers.R b/R/basemapLayers.R
index 36f64e2..5b495fe 100644
--- a/R/basemapLayers.R
+++ b/R/basemapLayers.R
@@ -4,28 +4,28 @@
#' Taken from \url{https://esri.github.io/esri-leaflet/api-reference/layers/basemap-layer.html}.
#' @export
esriBasemapLayers <- list(
- 'Streets' = 'Streets',
- 'Topographic' = 'Topographic',
- 'NationalGeographic' = 'NationalGeographic',
- 'Oceans' = 'Oceans',
- 'Gray' = 'Gray',
- 'DarkGray' = 'DarkGray',
- 'Imagery' = 'Imagery',
- 'ShadedRelief' = 'ShadedRelief',
- 'Terrain' = 'Terrain')
+ "Streets" = "Streets",
+ "Topographic" = "Topographic",
+ "NationalGeographic" = "NationalGeographic",
+ "Oceans" = "Oceans",
+ "Gray" = "Gray",
+ "DarkGray" = "DarkGray",
+ "Imagery" = "Imagery",
+ "ShadedRelief" = "ShadedRelief",
+ "Terrain" = "Terrain")
#' Esri basemap labels.
#'
#' Taken from \url{https://esri.github.io/esri-leaflet/api-reference/layers/basemap-layer.html#optional-labels}.
#' @export
esriBasemapLabels <- list(
- 'OceansLabels' = 'OceansLabels',
- 'GrayLabels' = 'GrayLabels',
- 'DarkGrayLabels' = 'DarkGrayLabels',
- 'ImageryLabels' = 'ImageryLabels',
- 'ImageryTransportation' = 'ImageryTransportation',
- 'ShadedReliefLabels' = 'ShadedReliefLabels',
- 'TerrainLabels' = 'TerrainLabels'
+ "OceansLabels" = "OceansLabels",
+ "GrayLabels" = "GrayLabels",
+ "DarkGrayLabels" = "DarkGrayLabels",
+ "ImageryLabels" = "ImageryLabels",
+ "ImageryTransportation" = "ImageryTransportation",
+ "ShadedReliefLabels" = "ShadedReliefLabels",
+ "TerrainLabels" = "TerrainLabels"
)
#' Adds a ArcGIS Basemap layer
@@ -37,7 +37,7 @@ esriBasemapLabels <- list(
#' @param options Basemap Layer Options. You can pass \code{\link[leaflet]{tileOptions}()}.
#' @examples \dontrun{
#' leaflet() %>%
-#' addEsriBasemapLayer(esriBasemapLayers$Oceans, autoLabels=TRUE)
+#' addEsriBasemapLayer(esriBasemapLayers$Oceans, autoLabels = TRUE)
#' }
#' @export
addEsriBasemapLayer <- function(
@@ -47,21 +47,21 @@ addEsriBasemapLayer <- function(
map <- addEsriDependency(map)
- if(is.null(options)) {
+ if (is.null(options)) {
options <- list()
}
- if(!(key %in% esriBasemapLayers || key %in% esriBasemapLabels)) {
+ if (!(key %in% esriBasemapLayers || key %in% esriBasemapLabels)) {
stop("Invalid Basemap layer Key")
}
labelLayer <- NULL
- if(autoLabels) {
- labelLayer <- esriBasemapLabels[[sprintf("%sLabels",key)]]
+ if (autoLabels) {
+ labelLayer <- esriBasemapLabels[[sprintf("%sLabels", key)]]
}
leaflet::invokeMethod(
map, leaflet::getMapData(map),
- 'addEsriBasemapLayer', key, labelLayer, layerId, group, options)
+ "addEsriBasemapLayer", key, labelLayer, layerId, group, options)
}
diff --git a/R/dynamicMapLayers.R b/R/dynamicMapLayers.R
index 2f953a6..aabafb0 100644
--- a/R/dynamicMapLayers.R
+++ b/R/dynamicMapLayers.R
@@ -1,53 +1,53 @@
#' Options for dynamic map layer.
#'
-#' @param format Output format of the image.
-#' @param transparent Allow the server to produce transparent images.
-#' @param f Server response content type.
-#' @param attribution Attribution from service metadata copyright text is automatically displayed in Leaflet's default control. This property can be used for customization.
-#' @param layers An array of Layer IDs like [3,4,5] to show from the service.
-#' @param layerDefs A string representing a query to run against the service before the image is rendered. This can be a string like "3:STATE_NAME='Kansas'" or an object mapping different queries to specific layers {3:"STATE_NAME='Kansas'", 2:"POP2007>25000"}.
-#' @param opacity Opacity of the layer. Should be a value between 0 (completely transparent) and 1 (completely opaque).
-#' @param position Position of the layer relative to other overlays.
-#' @param maxZoom Closest zoom level the layer will be displayed on the map.
-#' @param minZoom Furthest zoom level the layer will be displayed on the map.
-#' @param dynamicLayers JSON object literal used to manipulate the layer symbology defined in the service itself. Requires a 10.1 (or above) map service which supports dynamicLayers requests.
-#' @param token If you pass a token in your options it will be included in all requests to the service.
-#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
-#' @param useCors If this service should use CORS when making GET requests.
+#' @param format Output format of the image.
+#' @param transparent Allow the server to produce transparent images.
+#' @param f Server response content type.
+#' @param attribution Attribution from service metadata copyright text is automatically displayed in Leaflet's default control. This property can be used for customization.
+#' @param layers An array of Layer IDs like [3, 4, 5] to show from the service.
+#' @param layerDefs A string representing a query to run against the service before the image is rendered. This can be a string like "3:STATE_NAME="Kansas"" or an object mapping different queries to specific layers {3:"STATE_NAME="Kansas"", 2:"POP2007>25000"}.
+#' @param opacity Opacity of the layer. Should be a value between 0 (completely transparent) and 1 (completely opaque).
+#' @param position Position of the layer relative to other overlays.
+#' @param maxZoom Closest zoom level the layer will be displayed on the map.
+#' @param minZoom Furthest zoom level the layer will be displayed on the map.
+#' @param dynamicLayers JSON object literal used to manipulate the layer symbology defined in the service itself. Requires a 10.1 (or above) map service which supports dynamicLayers requests.
+#' @param token If you pass a token in your options it will be included in all requests to the service.
+#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
+#' @param useCors If this service should use CORS when making GET requests.
#' @param ... extra options
#' @export
dynamicMapLayerOptions <- function(
- format = 'png24',
+ format = "png24",
transparent = TRUE,
- f = 'json',
- attribution = '',
- layers = NULL,
+ f = "json",
+ attribution = "",
+ layers = NULL,
layerDefs = NULL,
opacity = 1,
- position = 'front',
+ position = "front",
maxZoom = NULL,
minZoom = NULL,
dynamicLayers = NULL,
- token = NULL,
- proxy = NULL,
- useCors = TRUE,
+ token = NULL,
+ proxy = NULL,
+ useCors = TRUE,
...
) {
leaflet::filterNULL(list(
- format = format,
+ format = format,
transparent = transparent,
f = f,
attribution = attribution,
- layers = layers,
+ layers = layers,
layerDefs = layerDefs,
opacity = opacity,
position = position,
maxZoom = maxZoom,
minZoom = minZoom,
dynamicLayers = dynamicLayers,
- token = token,
- proxy = proxy,
- useCors = useCors,
+ token = token,
+ proxy = proxy,
+ useCors = useCors,
...
))
@@ -77,11 +77,11 @@ addEsriDynamicMapLayer <- function(
popupFunction = NULL, popupOptions = NULL,
layerId = NULL, group = NULL) {
map <- addEsriDependency(map)
- if(is.null(options)) {
+ if (is.null(options)) {
options <- list()
}
leaflet::invokeMethod(
map, leaflet::getMapData(map),
- 'addEsriDynamicMapLayer', url, layerId, group,
+ "addEsriDynamicMapLayer", url, layerId, group,
options, popupFunction, popupOptions)
}
diff --git a/R/featureLayers.R b/R/featureLayers.R
index 289fcc8..b877a7b 100644
--- a/R/featureLayers.R
+++ b/R/featureLayers.R
@@ -1,30 +1,30 @@
#' Options for featureLayers.
#'
-#' @param where String An optional expression to filter features server side.
-#' String values should be denoted using single quotes ie: where: "FIELDNAME = 'field value'"; More information about valid SQL syntax can be found at \url{http://resources.arcgis.com/en/help/main/10.2/index.html#/SQL_reference_for_query_expressions_used_in_ArcGIS/00s500000033000000/}.
-#' @param minZoom Integer Minimum zoom level of the map that features will display.
+#' @param where String An optional expression to filter features server side.
+#' String values should be denoted using single quotes ie: where: "FIELDNAME = "field value""; More information about valid SQL syntax can be found at \url{http://resources.arcgis.com/en/help/main/10.2/index.html#/SQL_reference_for_query_expressions_used_in_ArcGIS/00s500000033000000/}.
+#' @param minZoom Integer Minimum zoom level of the map that features will display.
#' example: minZoom:0
-#' @param maxZoom Integer Maximum zoom level of the map that features will
+#' @param maxZoom Integer Maximum zoom level of the map that features will
#' example: maxZoom:19
-#' @param cacheLayers Boolean Will remove layers from the internal cache when they are removed from the map.
-#' @param fields Array An array of fieldnames to pull from the service.
-#' Includes all fields by default. You should always specify the name of the unique id for the service. Usually either 'FID' or 'OBJECTID'.
-#' @param from Date When paired with to defines the time range of features to display.
+#' @param cacheLayers Boolean Will remove layers from the internal cache when they are removed from the map.
+#' @param fields Array An array of fieldnames to pull from the service.
+#' Includes all fields by default. You should always specify the name of the unique id for the service. Usually either "FID" or "OBJECTID".
+#' @param from Date When paired with to defines the time range of features to display.
#' Requires the Feature Layer to be time enabled.
-#' @param to Date When paired with from defines the time range of features to display.
+#' @param to Date When paired with from defines the time range of features to display.
#' Requires the Feature Layer to be time enabled.
-#' @param timeField false The name of the field to lookup the time of the feature.
-#' Can be an object like {start:'startTime', end:'endTime'} or a string like 'created'.
-#' @param timeFilterMode 'server' (default) or 'client' Determines where features are filtered by time.
-#' By default features will be filtered by the server. If set to 'client' all features are requested and filtered by the app before display.
-#' @param simplifyFactor Integer How much to simplify polygons and polylines.
+#' @param timeField false The name of the field to lookup the time of the feature.
+#' Can be an object like {start:"startTime", end:"endTime"} or a string like "created".
+#' @param timeFilterMode "server" (default) or "client" Determines where features are filtered by time.
+#' By default features will be filtered by the server. If set to "client" all features are requested and filtered by the app before display.
+#' @param simplifyFactor Integer How much to simplify polygons and polylines.
#' More means better performance, and less means more accurate representation.
-#' @param precision Integer How many digits of precision to request from the server.
+#' @param precision Integer How many digits of precision to request from the server.
#' Wikipedia has a great reference of digit precision to meters at \url{http://en.wikipedia.org/wiki/Decimal_degrees}.
-#' @param token String If you pass a token in your options it will be included in all requests to the service.
-#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
-#' @param useCors Boolean If this service should use CORS when making GET requests.
-#' @param renderer L.svg or L.canvas The vector renderer to use to draw the service.
+#' @param token String If you pass a token in your options it will be included in all requests to the service.
+#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
+#' @param useCors Boolean If this service should use CORS when making GET requests.
+#' @param renderer L.svg or L.canvas The vector renderer to use to draw the service.
#' Usually L.svg but setting to L.canvas contains performance benefits for large polygon layers.
#' @param ... extra options
#' @export
@@ -78,7 +78,7 @@ featureLayerOptions <- function(
#' @param layerId A unique ID for the layer.
#' @param group The name of the group this layer should be added to.
#' the same parameter under \code{\link{addTiles}})
-#' @param markerType The type of marker. either 'marker' or 'circleMarker'
+#' @param markerType The type of marker. either "marker" or "circleMarker"
#' @param markerIcons Icons for Marker.
#' @param markerIconProperty The property of the feature to use for marker icon.
#' Can be a JS function which accepts a feature and returns an index of \code{markerIcons}.
@@ -146,7 +146,7 @@ addEsriFeatureLayer <- function(
map$dependencies <- c(map$dependencies,
leaflet.extras::leafletExtrasDependencies$omnivore())
- if(useServiceSymbology) {
+ if (useServiceSymbology) {
map <- addEsriRenderersDependency(map)
} else {
map <- addEsriDependency(map)
@@ -157,33 +157,33 @@ addEsriFeatureLayer <- function(
map <- addEsriClusterDependency(map)
}
- pathOptions = c(pathOptions, list(
+ pathOptions <- c(pathOptions, list(
stroke = stroke, color = color, weight = weight, opacity = opacity,
fill = fill, fillColor = fillColor, fillOpacity = fillOpacity,
dashArray = dashArray, smoothFactor = smoothFactor, noClip = noClip))
markerIconFunction <- NULL
- if(!is.null(markerIcons)) {
- if(inherits(markerIcons,'leaflet_icon_set') ||
- inherits(markerIcons, 'leaflet_icon')) {
+ if (!is.null(markerIcons)) {
+ if (inherits(markerIcons, "leaflet_icon_set") ||
+ inherits(markerIcons, "leaflet_icon")) {
markerIconFunction <- defIconFunction
- } else if(inherits(markerIcons,'leaflet_awesome_icon_set') ||
- inherits(markerIcons, 'leaflet_awesome_icon')) {
- if(inherits(markerIcons,'leaflet_awesome_icon_set')) {
- libs <- unique(sapply(markerIcons,function(icon) icon$library))
- map <- leaflet.extras::addAwesomeMarkersDependencies(map,libs)
+ } else if (inherits(markerIcons, "leaflet_awesome_icon_set") ||
+ inherits(markerIcons, "leaflet_awesome_icon")) {
+ if (inherits(markerIcons, "leaflet_awesome_icon_set")) {
+ libs <- unique(sapply(markerIcons, function(icon) icon$library))
+ map <- leaflet.extras::addAwesomeMarkersDependencies(map, libs)
} else {
map <- leaflet.extras::addAwesomeMarkersDependencies(
- map,markerIcons$library)
+ map, markerIcons$library)
}
markerIconFunction <- awesomeIconFunction
} else {
- stop('markerIcons should be created using either leaflet::iconList() or leaflet::awesomeIconList()')
+ stop("markerIcons should be created using either leaflet::iconList() or leaflet::awesomeIconList()")
}
}
leaflet::invokeMethod(
- map, leaflet::getMapData(map), 'addEsriFeatureLayer', url, options, layerId, group,
+ map, leaflet::getMapData(map), "addEsriFeatureLayer", url, options, layerId, group,
markerType, markerIcons,
markerIconProperty, markerOptions, markerIconFunction,
clusterOptions, clusterId,
@@ -217,5 +217,5 @@ addEsriHeatmapFeatureLayer <- function(
)))
leaflet::invokeMethod(
map, leaflet::getMapData(map),
- 'addEsriHeatmapFeatureLayer', url, layerId, group, options)
+ "addEsriHeatmapFeatureLayer", url, layerId, group, options)
}
diff --git a/R/htmlDependencies.R b/R/htmlDependencies.R
index 56c382c..727495b 100644
--- a/R/htmlDependencies.R
+++ b/R/htmlDependencies.R
@@ -1,7 +1,7 @@
esriDependency <- function() {
list(
htmltools::htmlDependency(
- "esri.leaflet",version = "1.0.4",
+ "esri.leaflet", version = "1.0.4",
system.file("htmlwidgets/lib/esri", package = "leaflet.esri"),
script = c("esri-leaflet.js", "esri-leaflet-bindings.js")
)
@@ -20,7 +20,7 @@ addEsriDependency <- function(map) {
esriClusterDependency <- function() {
list(
htmltools::htmlDependency(
- "esri.leaflet.cluster",version = "1.0.2",
+ "esri.leaflet.cluster", version = "1.0.2",
system.file("htmlwidgets/lib/esri-cluster", package = "leaflet.esri"),
script = c("esri-leaflet-clustered-feature-layer-src.js")
)
@@ -41,7 +41,7 @@ addEsriClusterDependency <- function(map) {
esriGeocoderDependency <- function() {
list(
htmltools::htmlDependency(
- "esri.leaflet.geocoder",version = "1.0.2",
+ "esri.leaflet.geocoder", version = "1.0.2",
system.file("htmlwidgets/lib/esri-geocoder", package = "leaflet.esri"),
script = c("esri-leaflet-geocoder.js"),
stylesheet = c("esri-leaflet-geocoder.css")
@@ -62,7 +62,7 @@ addEsriGeocoderDependency <- function(map) {
esriHeatmapDependency <- function() {
list(
htmltools::htmlDependency(
- "esri.leaflet.heatmap",version = "1.0.2",
+ "esri.leaflet.heatmap", version = "1.0.2",
system.file("htmlwidgets/lib/esri-heatmap", package = "leaflet.esri"),
script = c("leaflet-heat.js",
"esri-leaflet-heatmap-feature-layer.js")
@@ -83,7 +83,7 @@ addEsriHeatmapDependency <- function(map) {
esriRenderersDependency <- function() {
list(
htmltools::htmlDependency(
- "esri.leaflet.renderers",version = "1.0.2",
+ "esri.leaflet.renderers", version = "1.0.2",
system.file("htmlwidgets/lib/esri-renderers", package = "leaflet.esri"),
script = c("esri-leaflet-renderers.js")
)
diff --git a/R/iconFunctions.R b/R/iconFunctions.R
index 6af5b86..30d7f1d 100644
--- a/R/iconFunctions.R
+++ b/R/iconFunctions.R
@@ -1,6 +1,6 @@
defIconFunction <-
JS("function(icon){
- if(!$.isEmptyObject(icon)) {
+ if (!$.isEmptyObject(icon)) {
return L.icon(icon);
} else {
return L.icon();
@@ -9,8 +9,8 @@ defIconFunction <-
awesomeIconFunction <-
JS("function(icon){
- if(!$.isEmptyObject(icon)) {
- if(!icon.prefix) {
+ if (!$.isEmptyObject(icon)) {
+ if (!icon.prefix) {
icon.prefix = icon.library;
}
return L.AwesomeMarkers.icon(icon);
diff --git a/R/imageMapLayers.R b/R/imageMapLayers.R
index 8b72139..2c23208 100644
--- a/R/imageMapLayers.R
+++ b/R/imageMapLayers.R
@@ -1,46 +1,46 @@
#' Options for image map layer.
#'
-#' @param format Output format of the image.
-#' @param f Server response content type.
-#' @param opacity Opacity of the layer. Should be a value between 0 and 1.
-#' @param position Position of the layer relative to other overlays.
-#' @param maxZoom Closest zoom level the layer will be displayed on the map.
-#' @param minZoom Furthest zoom level the layer will be displayed on the map.
-#' @param from Date When paired with to defines the time range of data to display.
+#' @param format Output format of the image.
+#' @param f Server response content type.
+#' @param opacity Opacity of the layer. Should be a value between 0 and 1.
+#' @param position Position of the layer relative to other overlays.
+#' @param maxZoom Closest zoom level the layer will be displayed on the map.
+#' @param minZoom Furthest zoom level the layer will be displayed on the map.
+#' @param from Date When paired with to defines the time range of data to display.
#' Requires the Image Layer to be time enabled.
-#' @param to Date When paired with from defines the time range of data to display.
+#' @param to Date When paired with from defines the time range of data to display.
#' Requires the Image Layer to be time enabled.
-#' @param bandIds If there are multiple bands, you can specify which bands to export.
-#' @param noData The pixel value representing no information.
-#' @param noDataInterpretation Interpretation of the noData setting.
-#' @param pixelType Leave pixelType as unspecified, or UNKNOWN, in most exportImage use cases,
+#' @param bandIds If there are multiple bands, you can specify which bands to export.
+#' @param noData The pixel value representing no information.
+#' @param noDataInterpretation Interpretation of the noData setting.
+#' @param pixelType Leave pixelType as unspecified, or UNKNOWN, in most exportImage use cases,
#' unless such pixelType is desired.
#' Possible values: C128, C64, F32, F64, S16, S32, S8, U1, U16, U2, U32, U4, U8, UNKNOWN.
-#' @param renderingRule A JSON representation of a \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Raster_function_objects/02r3000000rv000000/}{raster function}
-#' @param mosaicRule A JSON representation of a \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Mosaic_rule_objects/02r3000000s4000000/}{mosaic rule}
-#' @param token If you pass a token in your options it will be included in all requests to the service.
-#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
-#' @param useCors If this service should use CORS when making GET requests.
+#' @param renderingRule A JSON representation of a \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Raster_function_objects/02r3000000rv000000/}{raster function}
+#' @param mosaicRule A JSON representation of a \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Mosaic_rule_objects/02r3000000s4000000/}{mosaic rule}
+#' @param token If you pass a token in your options it will be included in all requests to the service.
+#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
+#' @param useCors If this service should use CORS when making GET requests.
#' @param ... extra options
#' @export
imageMapLayerOptions <- function(
- format = 'jpgpng',
- f = 'json',
- opacity = 1,
- position = 'front',
- maxZoom = NULL,
- minZoom = NULL,
+ format = "jpgpng",
+ f = "json",
+ opacity = 1,
+ position = "front",
+ maxZoom = NULL,
+ minZoom = NULL,
from = NULL,
to = NULL,
- bandIds = NULL,
- noData = NULL,
- noDataInterpretation = NULL,
- pixelType = NULL,
- renderingRule = NULL,
- mosaicRule = NULL,
- token = NULL,
- proxy = NULL,
- useCors = TRUE,
+ bandIds = NULL,
+ noData = NULL,
+ noDataInterpretation = NULL,
+ pixelType = NULL,
+ renderingRule = NULL,
+ mosaicRule = NULL,
+ token = NULL,
+ proxy = NULL,
+ useCors = TRUE,
...
) {
leaflet::filterNULL(list(
@@ -86,11 +86,11 @@ addEsriImageMapLayer <- function(
popupFunction = NULL, popupOptions = NULL,
layerId = NULL, group = NULL) {
map <- addEsriDependency(map)
- if(is.null(options)) {
+ if (is.null(options)) {
options <- list()
}
leaflet::invokeMethod(
map, leaflet::getMapData(map),
- 'addEsriImageMapLayer', url, layerId, group,
+ "addEsriImageMapLayer", url, layerId, group,
options, popupFunction, popupOptions)
}
diff --git a/R/tiledMapLayers.R b/R/tiledMapLayers.R
index 7a6355e..eade5f1 100644
--- a/R/tiledMapLayers.R
+++ b/R/tiledMapLayers.R
@@ -2,10 +2,10 @@
#' Options for TiledMapLayer.
#'
#' @param correctZoomLevels Correct Zoom levels.
-#' @param zoomOffsetAllowance If correctZoomLevels is enabled this controls the amount of tolerance for the difference at each scale level for remapping tile levels.
-#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
-#' @param useCors Dictates if the service should use CORS when making GET requests.
-#' @param token Use this token to authenticate all calls to the service.
+#' @param zoomOffsetAllowance If correctZoomLevels is enabled this controls the amount of tolerance for the difference at each scale level for remapping tile levels.
+#' @param proxy URL of an \href{https://developers.arcgis.com/javascript/jshelp/ags_proxy.html}{ArcGIS API for JavaScript proxy} or \href{https://github.com/Esri/resource-proxy}{ArcGIS Resource Proxy} to use for proxying requests.
+#' @param useCors Dictates if the service should use CORS when making GET requests.
+#' @param token Use this token to authenticate all calls to the service.
#' @param tileOptions Other options for tile layer. You can pass \code{\link[leaflet]{tileOptions}()}.
#' @export
tiledMapLayerOptions <- function(
@@ -22,7 +22,7 @@ tiledMapLayerOptions <- function(
proxy = proxy,
useCors = useCors,
token = token
- ),tileOptions))
+ ), tileOptions))
}
#' Access tiles from ArcGIS Online and ArcGIS Server to visualize and identify features.
@@ -41,10 +41,10 @@ addEsriTiledMapLayer <- function(
layerId = NULL, group = NULL) {
map <- addEsriDependency(map)
- if(is.null(options)) {
+ if (is.null(options)) {
options <- list()
}
leaflet::invokeMethod(
map, leaflet::getMapData(map),
- 'addEsriTiledMapLayer', url, layerId, group, options)
+ "addEsriTiledMapLayer", url, layerId, group, options)
}
diff --git a/inst/examples/basemaps.R b/inst/examples/basemaps.R
index 0409c0d..55578c0 100644
--- a/inst/examples/basemaps.R
+++ b/inst/examples/basemaps.R
@@ -8,13 +8,13 @@ library(leaflet.esri)
basemaps <- esriBasemapLayers
# Continental US
-l <- leaflet() %>% setView(-98.35,39.5,3)
+l <- leaflet() %>% setView(-98.35, 39.5, 3)
purrr::walk(basemaps,
function(basemap) {
- l <<- l %>% addEsriBasemapLayer(key=basemap, autoLabels=TRUE,
- group=basemap,
- options = list(detectRetina=TRUE))
+ l <<- l %>% addEsriBasemapLayer(key = basemap, autoLabels = TRUE,
+ group = basemap,
+ options = list(detectRetina = TRUE))
})
l %>%
diff --git a/inst/examples/buildExamples.R b/inst/examples/buildExamples.R
index 1dd2a4d..6f1816a 100644
--- a/inst/examples/buildExamples.R
+++ b/inst/examples/buildExamples.R
@@ -1,30 +1,30 @@
-examples.dir <- 'inst/examples'
+examples_dir <- "inst/examples"
-r.files <- as.list(dir(examples.dir, pattern = '.*\\.R$', full.names = TRUE))
-names(r.files) <- r.files
+r_files <- as.list(dir(examples_dir, pattern = ".*\\.R$", full.names = TRUE))
+names(r_files) <- r_files
# exclude self
-r.files['inst/examples/buildExamples.R'] <- NULL
-r.files <- unlist(r.files)
-names(r.files) <- NULL
+r_files["inst/examples/buildExamples.R"] <- NULL
+r_files <- unlist(r_files)
+names(r_files) <- NULL
-rmd.files <- stringr::str_c(r.files,'md')
-html.files <- stringr::str_c(tools::file_path_sans_ext(r.files),'html')
+rmd_files <- stringr::str_c(r_files, "md")
+html_files <- stringr::str_c(tools::file_path_sans_ext(r_files), "html")
-r.files.mtimes <- file.info(r.files,extra_cols = FALSE)[,4]
+r_files_mtimes <- file.info(r_files, extra_cols = FALSE)[, 4]
-df <- data.frame(r.file=r.files, r.file.mtime = r.files.mtimes,
- rmd.file = rmd.files, html.file = html.files,
+df <- data.frame(r_file = r_files, r_file_mtime = r_files_mtimes,
+ rmd_file = rmd_files, html_file = html_files,
stringsAsFactors = FALSE)
-rm(r.files, rmd.files, html.files, r.files.mtimes)
+rm(r_files, rmd_files, html_files, r_files_mtimes)
-purrr::pwalk(df, function(r.file, r.file.mtime, rmd.file, html.file) {
- if(!file.exists(rmd.file) || file.info(rmd.file)[,4] < r.file.mtime ) {
- knitr::spin(r.file, knit = FALSE, format = 'Rmd')
- rmarkdown::render(rmd.file,'html_document')
+purrr::pwalk(df, function(r_file, r_file_mtime, rmd_file, html_file) {
+ if (!file.exists(rmd_file) || file.info(rmd_file)[, 4] < r_file_mtime ) {
+ knitr::spin(r_file, knit = FALSE, format = "Rmd")
+ rmarkdown::render(rmd_file, "html_document")
}
})
diff --git a/inst/examples/dynamicMapLayers.R b/inst/examples/dynamicMapLayers.R
index 4048316..24fb1be 100644
--- a/inst/examples/dynamicMapLayers.R
+++ b/inst/examples/dynamicMapLayers.R
@@ -9,23 +9,23 @@ library(leaflet.esri)
#' Custom Javascript for identifying features.