Skip to content

Commit

Permalink
expose resolution and opacity for people to play. r-spatial/mapview#305
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-salabim committed Jul 9, 2020
1 parent 7ae2b86 commit 04a145a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion R/addGeoRaster.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ addGeoRaster = function(map,
file = NULL,
url = NULL,
group = NULL,
layerId = NULL) {
layerId = NULL,
resolution = 96,
opacity = 0.8) {

if (inherits(map, "mapview")) map = mapview2leaflet(map)

Expand Down Expand Up @@ -35,6 +37,8 @@ addGeoRaster = function(map,
, url
, group
, layerId
, resolution
, opacity
)
} else {
map$dependencies <- c(
Expand All @@ -49,6 +53,8 @@ addGeoRaster = function(map,
, url
, group
, layerId
, resolution
, opacity
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
LeafletWidget.methods.addGeoRaster = function (url,
group,
layerId) {
layerId,
resolution,
opacity) {

var map = this;

Expand All @@ -19,7 +21,8 @@ LeafletWidget.methods.addGeoRaster = function (url,
console.log("georaster:", georaster);
var layer = new GeoRasterLayer({
georaster: georaster,
resolution: 96
resolution: resolution,
opacity: opacity
});
layer.addTo(map);
map.fitBounds(layer.getBounds());
Expand Down

0 comments on commit 04a145a

Please sign in to comment.