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

Commit

Permalink
Support for ImageMapLayer
Browse files Browse the repository at this point in the history
and moved docs to pkgdown.
  • Loading branch information
Bhaskar Karambelkar committed Feb 1, 2017
1 parent fa580a8 commit 6e1852d
Show file tree
Hide file tree
Showing 81 changed files with 3,147 additions and 9,586 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
^README-.*\.png$
^inst/examples
^docs/

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Suggests:
memoise
URL: https://github.com/bhaskarvk/leaflet.esri
BugReports: https://github.com/bhaskarvk/leaflet.esri/issues
RoxygenNote: 5.0.1
RoxygenNote: 6.0.0
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2016
YEAR: 2016-2017
COPYRIGHT HOLDER: Bhaskar V. Karambelkar
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export(addEsriFeatureLayer)
export(addEsriGeocoderDependency)
export(addEsriHeatmapDependency)
export(addEsriHeatmapFeatureLayer)
export(addEsriImageMapLayer)
export(addEsriRenderersDependency)
export(addEsriTiledMapLayer)
export(dynamicMapLayerOptions)
export(esriBasemapLabels)
export(esriBasemapLayers)
export(featureLayerOptions)
export(imageMapLayerOptions)
export(tiledMapLayerOptions)
import(leaflet)
import(leaflet.extras)
Expand Down
14 changes: 11 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# leaflet.esri 0.1.3

* Support for DynamicMapLayer and ImageMapLayer
## Major changes

- Support for DynamicMapLayer
- Support for ImageMapLayer

# leaflet.esri 0.1.2

* Support for FeatureLayer & TiledMapLayer.
## Major changes

- Support for FeatureLayer
- Support for TiledMapLayer

# leaflet.esri 0.1.0

* Initial Release with Esri basemap layers support.
## Major changes

- Initial Release with Esri basemap layers support
4 changes: 2 additions & 2 deletions R/dynamicMapLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ dynamicMapLayerOptions <- function(
#' identifying features and more.
#' Also supports custom popups and identification of features.
#' @param map The leaflet map
#' @param url URL of the \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Map_Service/02r3000000w2000000}{Map Service} with a tile cache.
#' @param options options for the tiledmap layer.
#' @param url URL of the \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Map_Service/02r3000000w2000000/}{Map Service}.
#' @param options options for the dynamic map layer.
#' @param popupFunction Uses the provided function to create a popup that will
#' identify features whenever the map is clicked.
#' Your function will be passed a GeoJSON FeatureCollection of the features
Expand Down
9 changes: 5 additions & 4 deletions R/featureLayers.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ addEsriFeatureLayer <- function(
}
}

invokeMethod(
map, getMapData(map), 'addEsriFeatureLayer', url, options, layerId, group,
leaflet::invokeMethod(
map, leaflet::getMapData(map), 'addEsriFeatureLayer', url, options, layerId, group,
markerType, markerIcons,
markerIconProperty, markerOptions, markerIconFunction,
clusterOptions, clusterId,
Expand All @@ -209,6 +209,7 @@ addEsriHeatmapFeatureLayer <- function(
radius = radius,
gradient = gradient
)))
invokeMethod(
map, getMapData(map), 'addEsriHeatmapFeatureLayer', url, layerId, group, options)
leaflet::invokeMethod(
map, leaflet::getMapData(map),
'addEsriHeatmapFeatureLayer', url, layerId, group, options)
}
96 changes: 96 additions & 0 deletions R/imageMapLayers.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#' 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.
#' Requires the Image Layer to be time enabled.
#' @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,
#' 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 ... extra options
#' @export
imageMapLayerOptions <- function(
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,
...
) {
leaflet::filterNULL(list(
format = format,
f = f,
opacity = opacity,
position = position,
maxZoom = maxZoom,
minZoom = minZoom,
from = from,
to = to,
bandIds = bandIds,
noData = noData,
noDataInterpretation = noDataInterpretation,
pixelType = pixelType,
renderingRule = renderingRule,
mosaicRule = mosaicRule,
token = token,
proxy = proxy,
useCors = useCors,
...
))
}

#' Render and visualize Image Services from ArcGIS Online and ArcGIS Server.
#'
#' Image Services provide access to raster data through a web service.
#' @param map The leaflet map
#' @param url URL of the \href{http://resources.arcgis.com/en/help/arcgis-rest-api/#/Image_Service/02r3000000q8000000/}{Image Service}
#' @param options options for the image map layer.
#' @param popupFunction Uses the provided function to create a popup that will
#' identify features whenever the map is clicked.
#' Your function will be passed a GeoJSON FeatureCollection of the features
#' at the clicked location and should return the appropriate HTML.
#' If you do not want to open the popup when there are no results, return false.
#' @param popupOptions See \code{\link[leaflet]{popupOptions}}.
#' @param layerId A unique ID for the layer.
#' @param group The name of the group this layer should be added to.
#' @export
addEsriImageMapLayer <- function(
map, url,
options = imageMapLayerOptions(),
popupFunction = NULL, popupOptions = NULL,
layerId = NULL, group = NULL) {
map <- addEsriDependency(map)
if(is.null(options)) {
options <- list()
}
leaflet::invokeMethod(
map, leaflet::getMapData(map),
'addEsriImageMapLayer', url, layerId, group,
options, popupFunction, popupOptions)
}
1 change: 1 addition & 0 deletions R/leaflet.esri-package.r
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#'
#' @name leaflet.esri
#' @docType package
#' @author Bhaskar V. Karambelkar
NULL
23 changes: 12 additions & 11 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ ESRI bindings for the [leaflet](https://www.github.com/rstudio/leaflet) package,

**Compatibility Matrix**

As of Feb, 2017 the leaflet R package is based on version 0.7.7 of the Leaflet Javascript library and therefore the leaflet.esri package is based on version 1.0.4 of esri-leaflet Jaascript library which is the last release compatible with the 0.7.x branch of Leaflet JS.
The chart below shows more details.

| Leaflet JS ver. | R Leaflet pkg ver. | esri-leaflet JS Plugin ver. | R leaflet.esri pkg ver.|
| --------------- | ------------------ | --------------------------- | -------------------- |
| [0.7.x](https://github.com/Leaflet/Leaflet/releases/tag/v0.7.7) | [1.1](https://github.com/rstudio/leaflet) <sup>1</sup> | [1.0.4](https://github.com/Esri/esri-leaflet/releases/tag/v1.0.4) | 0.1.x |
| [1.x](https://github.com/Leaflet/Leaflet/releases/tag/v1.0.1) | ? <sup>2</sup> | [2.x](https://github.com/Esri/esri-leaflet/releases/tag/v2.0.4) | ? |

1 - Release 1.1 of the leaflet package should hit CRAN very soon, for now `devtools::install_github('rstudio/leaflet')`. <br/>
1 - Release 1.1 of the leaflet package should hit CRAN very soon, but for now `devtools::install_github('rstudio/leaflet')`. <br/>
2 - The R package has not yet been proted to Leaflet JS 1.x

### Features Tracking

**NOTE** It may not be possible to implement each and every feature and the documentation will be updated accordingly. Each feature which is implemented has a tick mark (✔️) next to it. Any description you find in this section is directly taken from the esri-leaflt [API reference](https://esri.github.io/esri-leaflet/api-reference/).
**NOTE** It may not be possible to implement each and every feature and if so the documentation will be updated accordingly. Each feature which is implemented has a tick mark (✔️) next to it. Any description you find in this section is directly taken from the esri-leaflt [API reference](https://esri.github.io/esri-leaflet/api-reference/).

#### Authentication Support

Expand All @@ -33,7 +36,7 @@ ESRI bindings for the [leaflet](https://www.github.com/rstudio/leaflet) package,
Layers provide visualization capabilities for data hosted in Feature Services, Map Services and Image Services.

- [Basemap Layer](https://esri.github.io/esri-leaflet/api-reference/layers/basemap-layer.html) ✔️
- [Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html) - IN Progress
- [Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html) - ✔️ (Except for Edit Features)
- Labels ✔️
- Popups ✔️
- Markers w/ Icons ✔️
Expand All @@ -44,8 +47,7 @@ Layers provide visualization capabilities for data hosted in Feature Services, M
- [Cluster Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/clustered-feature-layer.html) ✔️
- [Heat Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/heatmap-feature-layer.html) ✔️
- [Dynamic Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/dynamic-map-layer.html) ✔️
- [Image Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/image-map-layer.html)
- [Raster Layer](https://esri.github.io/esri-leaflet/api-reference/layers/raster-layer.html)
- [Image Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/image-map-layer.html) ✔️
- [Tiled Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/tiled-map-layer.html) ✔️
- ~~[Vector Basemap](https://esri.github.io/esri-leaflet/api-reference/layers/vector-basemap.html)~~ Cannot be supported for now as this requires leaflet 1.x.
- [~~Vector Layer~~](https://esri.github.io/esri-leaflet/api-reference/layers/vector-layer.html) Cannot be supported for now as this requires leaflet 1.x.
Expand All @@ -58,10 +60,10 @@ Layers provide visualization capabilities for data hosted in Feature Services, M

Tasks are wrappers for commonly used API methods on ArcGIS services. They expose commonly used parameters to make them more accessible to Leaflet.

- [Query](https://esri.github.io/esri-leaflet/api-reference/tasks/query.html)
- [Find](https://esri.github.io/esri-leaflet/api-reference/tasks/find.html)
- [IdentifyFeatures](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-features.html)
- [IdentifyImage](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-image.html)
- [Query](https://esri.github.io/esri-leaflet/api-reference/tasks/query.html) ✔️
- [Find](https://esri.github.io/esri-leaflet/api-reference/tasks/find.html) ✔️
- [IdentifyFeatures](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-features.html) ✔️
- [IdentifyImage](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-image.html) ✔️
- [Geocode](https://esri.github.io/esri-leaflet/api-reference/tasks/geocode.html)
- [Reverse Geocode](https://esri.github.io/esri-leaflet/api-reference/tasks/reverse-geocode.html)
- [Suggest](https://esri.github.io/esri-leaflet/api-reference/tasks/suggest.html)
Expand All @@ -70,14 +72,13 @@ Tasks are wrappers for commonly used API methods on ArcGIS services. They expose

#### Events

[Event](https://esri.github.io/esri-leaflet/api-reference/events.html) types common across components of Esri Leaflet.
[Event](https://esri.github.io/esri-leaflet/api-reference/events.html) types common across components of Esri Leaflet. ✔️

- loading
- load
- createfeature
- removefeature
- addfeature
- ???

### License

Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ESRI bindings for the [leaflet](https://www.github.com/rstudio/leaflet) package,

**Compatibility Matrix**

As of Feb, 2017 the leaflet R package is based on version 0.7.7 of the Leaflet Javascript library and therefore the leaflet.esri package is based on version 1.0.4 of esri-leaflet Jaascript library which is the last release compatible with the 0.7.x branch of Leaflet JS. The chart below shows more details.

<table>
<colgroup>
<col width="19%" />
Expand Down Expand Up @@ -38,11 +40,11 @@ ESRI bindings for the [leaflet](https://www.github.com/rstudio/leaflet) package,
</tbody>
</table>

1 - Release 1.1 of the leaflet package should hit CRAN very soon, for now `devtools::install_github('rstudio/leaflet')`. <br/> 2 - The R package has not yet been proted to Leaflet JS 1.x
1 - Release 1.1 of the leaflet package should hit CRAN very soon, but for now `devtools::install_github('rstudio/leaflet')`. <br/> 2 - The R package has not yet been proted to Leaflet JS 1.x

### Features Tracking

**NOTE** It may not be possible to implement each and every feature and the documentation will be updated accordingly. Each feature which is implemented has a tick mark (✔️) next to it. Any description you find in this section is directly taken from the esri-leaflt [API reference](https://esri.github.io/esri-leaflet/api-reference/).
**NOTE** It may not be possible to implement each and every feature and if so the documentation will be updated accordingly. Each feature which is implemented has a tick mark (✔️) next to it. Any description you find in this section is directly taken from the esri-leaflt [API reference](https://esri.github.io/esri-leaflet/api-reference/).

#### Authentication Support

Expand All @@ -55,7 +57,7 @@ ESRI bindings for the [leaflet](https://www.github.com/rstudio/leaflet) package,
Layers provide visualization capabilities for data hosted in Feature Services, Map Services and Image Services.

- [Basemap Layer](https://esri.github.io/esri-leaflet/api-reference/layers/basemap-layer.html) ✔️
- [Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html) - IN Progress
- [Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html) - ✔️ (Except for Edit Features)
- Labels ✔️
- Popups ✔️
- Markers w/ Icons ✔️
Expand All @@ -66,8 +68,7 @@ Layers provide visualization capabilities for data hosted in Feature Services, M
- [Cluster Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/clustered-feature-layer.html) ✔️
- [Heat Feature Layer](https://esri.github.io/esri-leaflet/api-reference/layers/heatmap-feature-layer.html) ✔️
- [Dynamic Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/dynamic-map-layer.html) ✔️
- [Image Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/image-map-layer.html)
- [Raster Layer](https://esri.github.io/esri-leaflet/api-reference/layers/raster-layer.html)
- [Image Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/image-map-layer.html) ✔️
- [Tiled Map Layer](https://esri.github.io/esri-leaflet/api-reference/layers/tiled-map-layer.html) ✔️
- ~~[Vector Basemap](https://esri.github.io/esri-leaflet/api-reference/layers/vector-basemap.html)~~ Cannot be supported for now as this requires leaflet 1.x.
- [~~Vector Layer~~](https://esri.github.io/esri-leaflet/api-reference/layers/vector-layer.html) Cannot be supported for now as this requires leaflet 1.x.
Expand All @@ -80,10 +81,10 @@ Layers provide visualization capabilities for data hosted in Feature Services, M

Tasks are wrappers for commonly used API methods on ArcGIS services. They expose commonly used parameters to make them more accessible to Leaflet.

- [Query](https://esri.github.io/esri-leaflet/api-reference/tasks/query.html)
- [Find](https://esri.github.io/esri-leaflet/api-reference/tasks/find.html)
- [IdentifyFeatures](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-features.html)
- [IdentifyImage](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-image.html)
- [Query](https://esri.github.io/esri-leaflet/api-reference/tasks/query.html) ✔️
- [Find](https://esri.github.io/esri-leaflet/api-reference/tasks/find.html) ✔️
- [IdentifyFeatures](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-features.html) ✔️
- [IdentifyImage](https://esri.github.io/esri-leaflet/api-reference/tasks/identify-image.html) ✔️
- [Geocode](https://esri.github.io/esri-leaflet/api-reference/tasks/geocode.html)
- [Reverse Geocode](https://esri.github.io/esri-leaflet/api-reference/tasks/reverse-geocode.html)
- [Suggest](https://esri.github.io/esri-leaflet/api-reference/tasks/suggest.html)
Expand All @@ -92,14 +93,13 @@ Tasks are wrappers for commonly used API methods on ArcGIS services. They expose

#### Events

[Event](https://esri.github.io/esri-leaflet/api-reference/events.html) types common across components of Esri Leaflet.
[Event](https://esri.github.io/esri-leaflet/api-reference/events.html) types common across components of Esri Leaflet. ✔️

- loading
- load
- createfeature
- removefeature
- addfeature
- ???

### License

Expand Down
2 changes: 2 additions & 0 deletions docs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2016
COPYRIGHT HOLDER: Bhaskar V. Karambelkar
Loading

0 comments on commit 6e1852d

Please sign in to comment.