├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ ├── R-CMD-check.yaml │ ├── pkgdown.yaml │ └── test-coverage.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── NEWS ├── NEWS.md ├── R ├── AAAmapviewClasses.R ├── burst.R ├── color.R ├── cubeView.R ├── extensions.R ├── extent.R ├── fgb.R ├── files.R ├── garnishMap.R ├── initpkg.R ├── leafletControls.R ├── legend.R ├── mapView.R ├── mapshot.R ├── mapview-defunct.R ├── mapview-package.R ├── mapviewControls.R ├── mapviewHighlightOptions.R ├── missing.R ├── ops.R ├── options.R ├── plainView.R ├── popup.R ├── print.R ├── projection.R ├── raster.R ├── sf.R ├── shiny-mapview.R ├── slideView.R ├── stars.R ├── sync.R ├── viewRGB.R ├── watch.R └── xy.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── data ├── breweries.rda ├── franconia.rda └── trails.rda ├── inst ├── extdata │ └── kiliNDVI.tif ├── htmlwidgets │ └── lib │ │ └── css │ │ ├── mapview-popup.css │ │ └── mapview.css ├── templates │ ├── popup-graph.brew │ └── popup.brew └── tinytest │ ├── test-color.R │ ├── test-mapview.R │ └── test-mapviewControls.R ├── man ├── breweries.Rd ├── figures │ └── basic_small.png ├── franconia.Rd ├── knit_print.mapview.Rd ├── mapView.Rd ├── mapshot.Rd ├── mapview-class.Rd ├── mapview-defunct.Rd ├── mapview-package.Rd ├── mapviewColors.Rd ├── mapviewOptions.Rd ├── mapviewOutput.Rd ├── mapviewWatcher.Rd ├── npts.Rd ├── ops.Rd ├── print-mapview-method.Rd ├── removeMapJunk.Rd ├── renderMapview.Rd ├── show-mapview-method.Rd ├── trails.Rd ├── viewExtent.Rd └── viewRGB.Rd ├── mapview.Rproj ├── tests └── tinytest.R └── vignettes ├── articles ├── mapview_01-basics.Rmd ├── mapview_02-advanced.Rmd ├── mapview_03-options.Rmd ├── mapview_04-popups.Rmd ├── mapview_05-extras.Rmd ├── mapview_06-add.Rmd └── mapview_07-pipe.Rmd └── popup_graphs ├── tmp_1.html └── tmp_1_files ├── HomeButton-0.0.1 ├── LICENSE ├── easy-button-src.min.js ├── glyphicons-21-home.png ├── home-button.css └── home-button.js ├── PopupTable-0.0.1 └── popup.css ├── Proj4Leaflet-1.0.1 ├── proj4-compressed.js ├── proj4.js └── proj4leaflet.js ├── htmlwidgets-1.2 └── htmlwidgets.js ├── jquery-1.12.4 ├── jquery.js └── jquery.min.js ├── leaflet-1.3.1 ├── images │ ├── layers-2x.png │ ├── layers.png │ ├── marker-icon-2x.png │ ├── marker-icon.png │ └── marker-shadow.png ├── leaflet-src.js ├── leaflet-src.js.map ├── leaflet.css ├── leaflet.js └── leaflet.js.map ├── leaflet-binding-2.0.0.9000 ├── leaflet.js ├── leaflet.yaml ├── lib │ ├── jquery │ │ ├── jquery.js │ │ └── jquery.min.js │ ├── leaflet-measure │ │ ├── images │ │ │ ├── cancel.png │ │ │ ├── cancel_@2X.png │ │ │ ├── check.png │ │ │ ├── check_@2X.png │ │ │ ├── focus.png │ │ │ ├── focus_@2X.png │ │ │ ├── rulers.png │ │ │ ├── rulers_@2X.png │ │ │ ├── start.png │ │ │ ├── start_@2X.png │ │ │ ├── trash.png │ │ │ └── trash_@2X.png │ │ ├── leaflet-measure.css │ │ ├── leaflet-measure.js │ │ └── leaflet-measure.min.js │ ├── leaflet-omnivore │ │ ├── LICENSE │ │ ├── index.js │ │ ├── leaflet-omnivore.min.js │ │ └── package.json │ ├── leaflet-providers │ │ ├── leaflet-providers.js │ │ ├── package.json │ │ ├── providers.json │ │ └── rstudio_install.md │ ├── leaflet │ │ ├── images │ │ │ ├── layers-2x.png │ │ │ ├── layers.png │ │ │ ├── marker-icon-2x.png │ │ │ ├── marker-icon.png │ │ │ └── marker-shadow.png │ │ ├── leaflet-src.js │ │ ├── leaflet-src.js.map │ │ ├── leaflet.css │ │ ├── leaflet.js │ │ └── leaflet.js.map │ ├── leafletfix │ │ └── leafletfix.css │ └── rstudio_leaflet │ │ ├── images │ │ └── 1px.png │ │ └── rstudio_leaflet.css └── plugins │ ├── Leaflet-MiniMap │ ├── Control.MiniMap.css │ ├── Control.MiniMap.js │ ├── Control.MiniMap.min.css │ ├── Control.MiniMap.min.js │ ├── Minimap-binding.js │ └── images │ │ ├── toggle.png │ │ └── toggle.svg │ ├── Leaflet.EasyButton │ ├── EasyButton-binding.js │ ├── LICENSE │ ├── easy-button.css │ └── easy-button.js │ ├── Leaflet.Graticule │ ├── Graticule-binding.js │ ├── L.Graticule.js │ └── Leaflet.Graticule.js │ ├── Leaflet.SimpleGraticule │ ├── L.SimpleGraticule.css │ ├── L.SimpleGraticule.js │ └── SimpleGraticule-binding.js │ ├── Leaflet.Terminator │ ├── L.Terminator.js │ └── Terminator-binding.js │ ├── Leaflet.awesome-markers │ ├── bootstrap-theme.min.css │ ├── bootstrap.min.css │ ├── bootstrap.min.js │ ├── font-awesome.min.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ ├── ionicons.eot │ │ ├── ionicons.svg │ │ ├── ionicons.ttf │ │ └── ionicons.woff │ ├── images │ │ ├── markers-matte.png │ │ ├── markers-matte@2x.png │ │ ├── markers-plain.png │ │ ├── markers-shadow.png │ │ ├── markers-shadow@2x.png │ │ ├── markers-soft.png │ │ └── markers-soft@2x.png │ ├── ionicons.min.css │ ├── leaflet.awesome-markers.css │ ├── leaflet.awesome-markers.js │ └── leaflet.awesome-markers.min.js │ ├── Leaflet.markercluster │ ├── MIT-LICENCE.txt │ ├── MarkerCluster.Default.css │ ├── MarkerCluster.css │ ├── leaflet.markercluster-src.js │ ├── leaflet.markercluster.freezable-src.js │ ├── leaflet.markercluster.freezable.js │ ├── leaflet.markercluster.js │ ├── leaflet.markercluster.layersupport-src.js │ ├── leaflet.markercluster.layersupport-src.js.map │ ├── leaflet.markercluster.layersupport.js │ └── package.json │ ├── Proj4Leaflet │ ├── proj4-compressed.js │ ├── proj4.js │ └── proj4leaflet.js │ ├── leaflet-locationfilter │ ├── img │ │ ├── filter-icon.png │ │ ├── move-handle.png │ │ └── resize-handle.png │ ├── locationfilter-bindings.js │ ├── locationfilter.css │ └── locationfilter.js │ └── leaflet-providers-plugin │ └── leaflet-providers-plugin.js ├── leaflet-providers-1.1.17 ├── leaflet-providers.js ├── package.json ├── providers.json └── rstudio_install.md ├── leaflet-providers-plugin-2.0.0.9000 └── leaflet-providers-plugin.js ├── leafletfix-1.0.0 └── leafletfix.css ├── mapPane-0.0.1 └── map-pane.js └── rstudio_leaflet-1.3.1 ├── images └── 1px.png └── rstudio_leaflet.css /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^inst/htmlwidgets/lib/leaflet/.bower.json 4 | ^.travis.yml 5 | ^basic_small.png 6 | ^docs$ 7 | ^vignettes$ 8 | ^tic.R 9 | ^README.Rmd 10 | ^\.ccache$ 11 | ^\.github$ 12 | .vscode 13 | ^_pkgdown\.yml$ 14 | ^pkgdown$ 15 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | 8 | name: R-CMD-check.yaml 9 | 10 | permissions: read-all 11 | 12 | jobs: 13 | R-CMD-check: 14 | runs-on: ${{ matrix.config.os }} 15 | 16 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 17 | 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | config: 22 | - {os: macos-latest, r: 'release'} 23 | - {os: windows-latest, r: 'release'} 24 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 25 | - {os: ubuntu-latest, r: 'release'} 26 | - {os: ubuntu-latest, r: 'oldrel-1'} 27 | 28 | env: 29 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 30 | R_KEEP_PKG_SOURCE: yes 31 | # prevent rgl issues because no X11 display is available 32 | RGL_USE_NULL: true 33 | 34 | steps: 35 | - uses: actions/checkout@v4 36 | 37 | - uses: r-lib/actions/setup-pandoc@v2 38 | 39 | - uses: r-lib/actions/setup-r@v2 40 | with: 41 | r-version: ${{ matrix.config.r }} 42 | http-user-agent: ${{ matrix.config.http-user-agent }} 43 | use-public-rspm: true 44 | 45 | - uses: r-lib/actions/setup-r-dependencies@v2 46 | with: 47 | extra-packages: any::rcmdcheck 48 | needs: check 49 | 50 | - uses: r-lib/actions/check-r-package@v2 51 | with: 52 | upload-snapshots: true 53 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' 54 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | release: 8 | types: [published] 9 | workflow_dispatch: 10 | 11 | name: pkgdown.yaml 12 | 13 | permissions: read-all 14 | 15 | jobs: 16 | pkgdown: 17 | runs-on: ubuntu-latest 18 | # Only restrict concurrency for non-PR jobs 19 | concurrency: 20 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 21 | env: 22 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 23 | permissions: 24 | contents: write 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - uses: r-lib/actions/setup-pandoc@v2 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | use-public-rspm: true 33 | 34 | - uses: r-lib/actions/setup-r-dependencies@v2 35 | with: 36 | extra-packages: any::pkgdown, local::. 37 | needs: website 38 | 39 | - name: Build site 40 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 41 | shell: Rscript {0} 42 | 43 | - name: Deploy to GitHub pages 🚀 44 | if: github.event_name != 'pull_request' 45 | uses: JamesIves/github-pages-deploy-action@v4.5.0 46 | with: 47 | clean: false 48 | branch: gh-pages 49 | folder: docs 50 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | 8 | name: test-coverage.yaml 9 | 10 | permissions: read-all 11 | 12 | jobs: 13 | test-coverage: 14 | runs-on: ubuntu-latest 15 | env: 16 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - uses: r-lib/actions/setup-r@v2 22 | with: 23 | use-public-rspm: true 24 | 25 | - uses: r-lib/actions/setup-r-dependencies@v2 26 | with: 27 | extra-packages: any::covr, any::xml2 28 | needs: coverage 29 | 30 | - name: Test coverage 31 | run: | 32 | cov <- covr::package_coverage( 33 | quiet = FALSE, 34 | clean = FALSE, 35 | install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") 36 | ) 37 | covr::to_cobertura(cov) 38 | shell: Rscript {0} 39 | 40 | - uses: codecov/codecov-action@v4 41 | with: 42 | # Fail if error if not on PR, or if on PR and token is given 43 | fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} 44 | file: ./cobertura.xml 45 | plugin: noop 46 | disable_search: true 47 | token: ${{ secrets.CODECOV_TOKEN }} 48 | 49 | - name: Show testthat output 50 | if: always() 51 | run: | 52 | ## -------------------------------------------------------------------- 53 | find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true 54 | shell: bash 55 | 56 | - name: Upload test results 57 | if: failure() 58 | uses: actions/upload-artifact@v4 59 | with: 60 | name: coverage-test-failures 61 | path: ${{ runner.temp }}/package 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /src/*.so 2 | /src/*.o 3 | /src/*.dll 4 | .Rproj.user 5 | .Rhistory 6 | .RData 7 | data.json 8 | test.dbf 9 | test.shp 10 | test.shx 11 | test2.shp.geojson 12 | mapview2.Rproj.RData 13 | README 14 | buildings.cpg 15 | buildings.dbf 16 | buildings.prj 17 | buildings.shp 18 | buildings.shx 19 | landuse.cpg 20 | landuse.dbf 21 | landuse.prj 22 | landuse.shp 23 | landuse.shx 24 | natural.cpg 25 | natural.dbf 26 | natural.prj 27 | natural.shp 28 | natural.shx 29 | places.cpg 30 | places.dbf 31 | places.prj 32 | places.shp 33 | places.shx 34 | points.cpg 35 | points.dbf 36 | points.prj 37 | points.shp 38 | points.shx 39 | railways.cpg 40 | railways.dbf 41 | railways.prj 42 | railways.shp 43 | railways.shx 44 | roads.cpg 45 | roads.dbf 46 | roads.prj 47 | roads.shp 48 | roads.shx 49 | switzerland.zip 50 | waterways.cpg 51 | waterways.dbf 52 | waterways.prj 53 | waterways.shp 54 | waterways.shx 55 | inst/doc 56 | docs/ 57 | .vscode 58 | docs 59 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: mapview 2 | Title: Interactive Viewing of Spatial Data in R 3 | Version: 2.11.2.9001 4 | Authors@R: 5 | c(person(given = "Tim", 6 | family = "Appelhans", 7 | role = c("cre", "aut"), 8 | email = "tim.appelhans@gmail.com"), 9 | person(given = "Florian", 10 | family = "Detsch", 11 | role = "aut", 12 | email = "fdetsch@web.de"), 13 | person(given = "Christoph", 14 | family = "Reudenbach", 15 | role = "aut", 16 | email = "reudenbach@geo.uni-marburg.de"), 17 | person(given = "Stefan", 18 | family = "Woellauer", 19 | role = "aut", 20 | email = "stephan.woellauer@geo.uni-marburg.de"), 21 | person(given = "Spaska", 22 | family = "Forteva", 23 | role = "ctb", 24 | email = "spaska.forteva@geo.uni-marburg.de"), 25 | person(given = "Thomas", 26 | family = "Nauss", 27 | role = "ctb", 28 | email = "nauss@staff.uni-marburg.de"), 29 | person(given = "Edzer", 30 | family = "Pebesma", 31 | role = "ctb"), 32 | person(given = "Kenton", 33 | family = "Russell", 34 | role = "ctb"), 35 | person(given = "Michael", 36 | family = "Sumner", 37 | role = "ctb"), 38 | person(given = "Jochen", 39 | family = "Darley", 40 | role = "ctb", 41 | email = "Debugger@jedimasters.de"), 42 | person(given = "Pierre", 43 | family = "Roudier", 44 | role = "ctb"), 45 | person(given = "Patrick", 46 | family = "Schratz", 47 | role = "ctb"), 48 | person(given = "Environmental Informatics Marburg", 49 | role = "ctb"), 50 | person(given = "Lorenzo", 51 | family = "Busetto", 52 | role = "ctb")) 53 | Maintainer: Tim Appelhans 54 | Description: Quickly and conveniently create interactive 55 | visualisations of spatial data with or without background maps. 56 | Attributes of displayed features are fully queryable via pop-up 57 | windows. Additional functionality includes methods to visualise true- 58 | and false-color raster images and bounding boxes. 59 | License: GPL (>= 3) | file LICENSE 60 | URL: https://github.com/r-spatial/mapview, https://r-spatial.github.io/mapview/ 61 | BugReports: https://github.com/r-spatial/mapview/issues 62 | Depends: 63 | methods, 64 | R (>= 3.6.0) 65 | Imports: 66 | base64enc, 67 | htmltools, 68 | htmlwidgets, 69 | lattice, 70 | leafem, 71 | leaflet (>= 2.0.0), 72 | leafpop, 73 | png, 74 | raster (>= 3.6.3), 75 | satellite, 76 | scales (>= 0.2.5), 77 | servr, 78 | sf, 79 | sp 80 | Suggests: 81 | knitr, 82 | later, 83 | leaflet.extras2, 84 | leafsync, 85 | lwgeom, 86 | mapdeck, 87 | plainview, 88 | poorman, 89 | rmarkdown, 90 | rstudioapi, 91 | s2, 92 | stars, 93 | tinytest, 94 | webshot, 95 | webshot2 96 | ByteCompile: yes 97 | Encoding: UTF-8 98 | LazyData: TRUE 99 | RoxygenNote: 7.3.2 100 | SystemRequirements: GNU make 101 | Roxygen: list(markdown = TRUE) 102 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(checkAdjustProjection,Raster) 4 | S3method(checkAdjustProjection,SpatialPointsDataFrame) 5 | S3method(checkAdjustProjection,sf) 6 | S3method(knitr::knit_print,mapview) 7 | export(mapViewPalette) 8 | export(mapshot) 9 | export(mapshot2) 10 | export(mapview) 11 | export(mapviewColors) 12 | export(mapviewGetOption) 13 | export(mapviewOptions) 14 | export(mapviewOutput) 15 | export(mapviewPalette) 16 | export(mapviewWatcher) 17 | export(npts) 18 | export(removeMapJunk) 19 | export(renderMapview) 20 | export(startWatching) 21 | export(stopWatching) 22 | export(viewExtent) 23 | export(viewRGB) 24 | exportClasses(mapview) 25 | exportMethods(mapView) 26 | import(base64enc) 27 | import(lattice) 28 | import(leaflet) 29 | import(methods) 30 | import(png) 31 | import(raster) 32 | import(satellite) 33 | import(scales) 34 | import(sf) 35 | import(sp) 36 | importFrom(grDevices,colorRampPalette) 37 | importFrom(grDevices,dev.off) 38 | importFrom(grDevices,grey.colors) 39 | importFrom(grDevices,png) 40 | importFrom(grDevices,rgb) 41 | importFrom(grDevices,svg) 42 | importFrom(leafem,addRasterRGB) 43 | importFrom(raster,projection) 44 | importFrom(sf,st_crs) 45 | importFrom(stats,na.omit) 46 | importFrom(utils,find) 47 | importFrom(utils,glob2rx) 48 | importFrom(utils,modifyList) 49 | -------------------------------------------------------------------------------- /R/AAAmapviewClasses.R: -------------------------------------------------------------------------------- 1 | #' Class mapview 2 | #' 3 | #' @slot object the spatial object 4 | #' @slot map the leaflet map object 5 | #' 6 | #' @exportClass mapview 7 | 8 | setClass('mapview', 9 | slots = c(object = 'list', 10 | map = 'ANY')) 11 | NULL 12 | 13 | setOldClass("leaflet") 14 | 15 | setOldClass(c("POINT", "MULTIPOINT", 16 | "POLYGON", "MULTIPOLYGON", 17 | "LINESTRING", "MULTILINESTRING")) 18 | 19 | setOldClass("XY") 20 | setOldClass("sf") 21 | setOldClass("sfc") 22 | setOldClass("sfg") 23 | setOldClass("XYM") 24 | setOldClass("XYZM") 25 | setOldClass("bbox") 26 | 27 | setOldClass("stars") 28 | setOldClass("stars_proxy") 29 | -------------------------------------------------------------------------------- /R/burst.R: -------------------------------------------------------------------------------- 1 | burst <- function(x, 2 | zcol, 3 | burst, 4 | ...) { 5 | 6 | if (is.null(zcol) & !burst) { 7 | x 8 | } else if (is.null(zcol) & burst) { 9 | burstByColumn(x = x, 10 | zcol = zcol) 11 | } else if (!is.null(zcol) & burst & length(zcol) == 1) { 12 | burstByRow(x = x, 13 | zcol = zcol) 14 | } else if (length(zcol) > 1) { 15 | burstByColumn(x = x, 16 | zcol = zcol) 17 | } 18 | 19 | } 20 | 21 | 22 | burstByColumn <- function(x, 23 | zcol, 24 | ...) { 25 | if (is.null(zcol)) zcol <- colnames(sf2DataFrame(x, drop_sf_column = TRUE)) 26 | # zcol = nms 27 | 28 | x_lst <- lapply(zcol, function(i) { 29 | x[, i, drop = FALSE] 30 | }) 31 | names(x_lst) <- zcol 32 | 33 | return(x_lst) 34 | } 35 | 36 | 37 | burstByRow <- function(x, 38 | zcol, 39 | ...) { 40 | x[[zcol]] <- as.character(x[[zcol]]) 41 | x[[zcol]][is.na(x[[zcol]])] <- "NA" 42 | 43 | lst <- split(x, x[[zcol]], drop = TRUE) #[as.character(x[[zcol]])] 44 | 45 | return(lst) 46 | } 47 | 48 | -------------------------------------------------------------------------------- /R/cubeView.R: -------------------------------------------------------------------------------- 1 | # #' View a RasterStack or RasterBrick as 3-dimensional data cube. 2 | # #' 3 | # #' @param x a RasterStack or RasterBrick 4 | # #' @param at the breakpoints used for the visualisation. See 5 | # #' \code{\link[lattice]{levelplot}} for details. 6 | # #' @param col.regions color (palette).See \code{\link[lattice]{levelplot}} for details. 7 | # #' @param na.color color for missing values. 8 | # #' @param legend logical. Whether to plot a legend. 9 | # #' @param ... currently not used. 10 | # #' 11 | # #' @export cubeView 12 | # #' @name cubeView 13 | # 14 | # cubeView <- function(x, 15 | # at, 16 | # col.regions = mapviewGetOption("raster.palette"), 17 | # na.color = mapviewGetOption("na.color"), 18 | # legend = TRUE) { 19 | # .Defunct(new = "cubeview::cubeView", package = "mapview") 20 | # } 21 | # 22 | # #' Widget output function for use in Shiny 23 | # #' 24 | # #' @param outputId Output variable to read from 25 | # #' @param width,height the width and height of the map 26 | # #' (see \code{\link{shinyWidgetOutput}}) 27 | # #' 28 | # #' @export 29 | # cubeViewOutput <- function(outputId, width = '100%', height = '400px'){ 30 | # .Defunct(new = "cubeview::cubeViewOutput", package = "mapview") 31 | # } 32 | # 33 | # #' Widget render function for use in Shiny 34 | # #' 35 | # #' @param expr An expression that generates an HTML widget 36 | # #' @param env The environment in which to evaluate expr 37 | # #' @param quoted Is expr a quoted expression (with quote())? 38 | # #' This is useful if you want to save an expression in a variable 39 | # #' 40 | # #' @export 41 | # renderCubeView <- function(expr, env = parent.frame(), quoted = FALSE) { 42 | # .Defunct(new = "cubeview::renderCubeView", package = "mapview") 43 | # } 44 | # 45 | # 46 | # ## cubeview =============================================================== 47 | # #' @describeIn cubeView alias for ease of typing 48 | # #' @aliases cubeview 49 | # #' @export cubeview 50 | # 51 | # cubeview <- function(...) { 52 | # .Defunct(new = "cubeview::cubeview", package = "mapview") 53 | # } 54 | # 55 | # 56 | -------------------------------------------------------------------------------- /R/extent.R: -------------------------------------------------------------------------------- 1 | #' View extent/bbox of spatial objects interactively 2 | #' @description 3 | #' This function produces an interactive view of the extent/bbox 4 | #' of the supplied spatial object 5 | #' 6 | #' @param x either a Raster*, sf* or Spatial* object 7 | #' @param map a leaflet or mapview map the extent should be added to. If NULL 8 | #' standard background layers are created. 9 | #' @param popup a \code{list} of HTML strings with the popup contents, usually 10 | #' created from \code{\link[leafpop]{popupTable}}. See \code{\link[leaflet]{addControl}} for 11 | #' details. 12 | #' @param layer.name the name of the layer to be shown on the map. 13 | #' @param alpha.regions opacity of the fills or the raster layer(s). 14 | #' @param label a character vector of labels to be shown on mouseover. See 15 | #' \code{\link[leaflet]{addControl}} for details. 16 | #' @inheritDotParams leaflet::addRectangles 17 | #' 18 | #' @author 19 | #' Tim Appelhans 20 | #' 21 | #' @examples 22 | #' library(leaflet) 23 | #' 24 | #' viewExtent(breweries) 25 | #' viewExtent(franconia) + breweries 26 | #' mapview(franconia) %>% leafem::addExtent(franconia, fillColor = "yellow") 27 | #' leaflet() %>% addProviderTiles("OpenStreetMap") %>% leafem::addExtent(breweries) 28 | #' leaflet() %>% addProviderTiles("OpenStreetMap") %>% leafem::addExtent(breweries) 29 | #' 30 | #' @name viewExtent 31 | #' @aliases viewExtent 32 | #' 33 | NULL 34 | 35 | ## View Extent ============================================================ 36 | #' @rdname viewExtent 37 | #' @export 38 | viewExtent <- function(x, 39 | map = NULL, 40 | popup = NULL, 41 | layer.name = NULL, 42 | alpha.regions = 0.2, 43 | label = NULL, 44 | ...) { 45 | 46 | # new line allows to do m <- mapview(trails) ; viewExtent(trails, m) 47 | if (inherits(map, "mapview")) map <- mapview2leaflet(map) 48 | 49 | if (is.null(layer.name)) { 50 | layer.name = paste(deparse(substitute(x)), "extent", sep = "-") 51 | } 52 | 53 | x = sf::st_as_sfc( 54 | sf::st_bbox( 55 | checkAdjustProjection(x) 56 | ) 57 | ) 58 | 59 | if (is.null(popup)) { 60 | pop = leafpop::popupTable( 61 | as.data.frame(t(attributes(x)$bbox[1:4])) 62 | , className = "mapview-popup" 63 | ) 64 | } 65 | 66 | mapView(x, 67 | map = map, 68 | popup = pop, 69 | layer.name = layer.name, 70 | alpha.regions = alpha.regions, 71 | label = label, 72 | ...) 73 | 74 | } 75 | 76 | # ## Add Extent ============================================================= 77 | # #' @describeIn viewExtent add extent/bbox of spatial/sf objects to a leaflet map - 78 | # #' This function is deprecated. 79 | # #' Please use leafem::\code{\link[leafem]{addExtent}} instead. 80 | # #' 81 | # #' @export addExtent 82 | # 83 | # addExtent <- function(map, data, ...) { 84 | # 85 | # .Defunct(new = "leafem::addExtent", package = "mapview") 86 | # 87 | # } 88 | 89 | 90 | 91 | ## combined extent =========================================================== 92 | combineExtent = function(lst, sf = FALSE, crs = 4326) { 93 | # lst = list(breweries, st_as_sf(atlStorms2005), st_as_sf(gadmCHE)) 94 | # bb = do.call(rbind, lapply(lst, sf::st_bbox)) 95 | bb = do.call(rbind, lapply(seq(lst), function(i) { 96 | if (!is.null(lst[[i]])) { 97 | if (!is.na(getProjection(lst[[i]]))) { 98 | sf::st_bbox(sf::st_transform(sf::st_as_sfc(sf::st_bbox(lst[[i]])), 99 | crs = crs)) 100 | } else { 101 | sf::st_bbox(sf::st_as_sfc(sf::st_bbox(lst[[i]]))) 102 | } 103 | } 104 | })) 105 | 106 | bbmin = apply(bb, 2, min) 107 | bbmax = apply(bb, 2, max) 108 | bb = c(bbmin[1], bbmin[2], bbmax[3], bbmax[4]) 109 | if (sf) { 110 | attr(bb, which = "class") = "bbox" 111 | attr(bb, "crs") = sf::st_crs(crs) 112 | return(sf::st_as_sfc(bb)) 113 | } 114 | return(bb) 115 | } 116 | -------------------------------------------------------------------------------- /R/garnishMap.R: -------------------------------------------------------------------------------- 1 | # #' Garnish/decorate leaflet or mapview maps. 2 | # #' 3 | # #' @description 4 | # #' This function provides a versatile interface to add components to a 5 | # #' leaflet or mapview map. It takes functions such as "addMouseCoordinates" 6 | # #' or \code{\link{addLayersControl}} and their respective arguments and adds 7 | # #' them to the map. Arguments must be named. Functions can be plain or 8 | # #' character strings. 9 | # #' 10 | # #' @param map a mapview or leaflet object. 11 | # #' @param ... functions and their arguments to add things to a map. 12 | # #' 13 | # #' @examples 14 | # #' library(leaflet) 15 | # #' library(leafem) 16 | # #' library(leafpop) 17 | # #' 18 | # #' m <- leaflet() %>% addProviderTiles("OpenStreetMap") 19 | # #' garnishMap(m, leafem::addMouseCoordinates, style = "basic") 20 | # #' 21 | # #' ## add more than one with named argument 22 | # #' library(raster) 23 | # #' 24 | # #' m1 <- garnishMap(m, leafem::addMouseCoordinates, leafem::addHomeButton, 25 | # #' ext = extent(breweries)) 26 | # #' m1 27 | # #' 28 | # #' ## even more flexible 29 | # #' m2 <- garnishMap(m1, addPolygons, data = franconia, 30 | # #' popup = leafpop::popupTable(franconia), 31 | # #' fillOpacity = 0.8, color = "black", fillColor = "#BEBEBE") 32 | # #' garnishMap(m2, addCircleMarkers, data = breweries) 33 | # #' 34 | # #' @export garnishMap 35 | # #' @name garnishMap 36 | # #' @rdname garnishMap 37 | # #' @aliases garnishMap 38 | # garnishMap <- function(map, ...) { 39 | # .Defunct(new = "leafem::garnishMap", package = "mapview") 40 | # } 41 | 42 | ### decorateMap lets you pass lists of functions with respective lists of 43 | ### named lists of arguments as in 44 | ### decorateMap(map, list(addCircleMarkers), list(list(data = breweries91))) 45 | decorateMap <- function(map, funs, args) { 46 | for (i in seq(funs)) { 47 | map <- do.call(leafem::garnishMap, c(list(map), funs[[i]], args[[i]])) 48 | } 49 | return(map) 50 | } 51 | -------------------------------------------------------------------------------- /R/initpkg.R: -------------------------------------------------------------------------------- 1 | .onLoad = function(libname, pkgname) { 2 | if (useFgb()) { 3 | mapviewOptions(fgb = TRUE) 4 | } 5 | } 6 | 7 | .onUnload = function(libpath) { 8 | mapview::stopWatching() 9 | } 10 | 11 | .onAttach = function(libname, pkgname) { 12 | msg = sprintf( 13 | "GDAL version >= 3.1.0 | setting mapviewOptions(fgb = TRUE)" 14 | ) 15 | if (useFgb()) { 16 | packageStartupMessage(msg) 17 | mapviewOptions(fgb = TRUE) 18 | } 19 | } 20 | 21 | .onDetach = function(libpath) { 22 | mapview::stopWatching() 23 | } 24 | -------------------------------------------------------------------------------- /R/mapview-defunct.R: -------------------------------------------------------------------------------- 1 | #' Defunct functions in mapview 2 | #' 3 | #' These functions have been removed from package \code{mapview}. 4 | #' See below for information on which package they have been moved to. 5 | #' 6 | #' \itemize{ 7 | #' \item \code{cubeview}: This function is defunct, and has been 8 | #' migrated to package 'cubeview'. 9 | #' \item \code{cubeView}: This function is defunct, and has been 10 | #' migrated to package 'cubeview'. 11 | #' \item \code{cubeViewOutput}: This function is defunct, and has been 12 | #' migrated to package 'cubeview'. 13 | #' \item \code{renderCubeView}: This function is defunct, and has been 14 | #' migrated to package 'cubeview'. 15 | #' \item \code{slideview}: This function is defunct, and has been 16 | #' migrated to package 'slideview'. 17 | #' \item \code{slideView}: This function is defunct, and has been 18 | #' migrated to package 'slideview'. 19 | #' \item \code{slideViewOutput}: This function is defunct, and has been 20 | #' migrated to package 'slideview'. 21 | #' \item \code{renderslideView}: This function is defunct, and has been 22 | #' migrated to package 'slideview'. 23 | #' \item \code{latticeView}: This function is defunct, and has been 24 | #' migrated to package 'leafsync'. 25 | #' \item \code{sync}: This function is defunct, and has been 26 | #' migrated to package 'leafsync'. 27 | #' \item \code{plainview}: This function is defunct, and has been 28 | #' migrated to package 'plainview'. 29 | #' \item \code{plainView}: This function is defunct, and has been 30 | #' migrated to package 'plainview'. 31 | #' \item \code{popupTable}: This function is defunct, and has been 32 | #' migrated to package 'leafpop'. 33 | #' \item \code{popupImage}: This function is defunct, and has been 34 | #' migrated to package 'leafpop'. 35 | #' \item \code{popupGraph}: This function is defunct, and has been 36 | #' migrated to package 'leafpop'. 37 | #' \item \code{addFeatures}: This function is defunct, and has been 38 | #' migrated to package 'leafem'. 39 | #' \item \code{garnishMap}: This function is defunct, and has been 40 | #' migrated to package 'leafem'. 41 | #' \item \code{addHomeButton}: This function is defunct, and has been 42 | #' migrated to package 'leafem'. 43 | #' \item \code{removeHomeButton}: This function is defunct, and has been 44 | #' migrated to package 'leafem'. 45 | #' \item \code{addImageQuery}: This function is defunct, and has been 46 | #' migrated to package 'leafem'. 47 | #' \item \code{addLogo}: This function is defunct, and has been 48 | #' migrated to package 'leafem'. 49 | #' \item \code{addMouseCoordinates}: This function is defunct, and has been 50 | #' migrated to package 'leafem'. 51 | #' \item \code{removeMouseCoordinates}: This function is defunct, and has been 52 | #' migrated to package 'leafem'. 53 | #' \item \code{addStaticLabels}: This function is defunct, and has been 54 | #' migrated to package 'leafem'. 55 | #' \item \code{addExtent}: This function is defunct, and has been 56 | #' migrated to package 'leafem'. 57 | #' \item \code{addStarsImage}: This function is defunct, and has been 58 | #' migrated to package 'leafem'. 59 | #' } 60 | #' 61 | #' @name mapview-defunct 62 | NULL 63 | -------------------------------------------------------------------------------- /R/mapview-package.R: -------------------------------------------------------------------------------- 1 | #' @import leaflet sp sf raster satellite scales methods png lattice base64enc 2 | #' @importFrom grDevices rgb dev.off png svg colorRampPalette grey.colors 3 | #' @importFrom utils find glob2rx 4 | #' @importFrom utils modifyList 5 | #' 6 | #' @details 7 | #' The package provides functionality to view spatial objects interactively. 8 | #' The intention is to provide interactivity for easy and quick visualization 9 | #' during spatial data analysis. It is not intended for fine-tuned presentation 10 | #' quality map production. 11 | #' 12 | "_PACKAGE" 13 | 14 | #' Selected breweries in Franconia 15 | #' @details This dataset contains selected breweries in Franconia. It is partly a 16 | #' subset of a larger database that was compiled by students at the 17 | #' University of Marburg for a seminar called 18 | #' "The Geography of Beer: sustainability in the food industry" 19 | #' and partly consists of breweries downloaded from 20 | #' \url{https://www.bierwandern.de/inhalt/brauereiliste.html} with the kind permission 21 | #' of Rainer Kastl. Note that use of these data is restricted to non-commercial use 22 | #' and that they are explicitly excluded from the GPL license that mapview is licensed under. 23 | #' @format \code{sf feature collection POINT} 24 | "breweries" 25 | 26 | #' Administrative district borders of Franconia 27 | #' 28 | #' @details The NUTS_2013_01M_SH.zip archive was downloaded on 23/03/2017 from 29 | #' \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts}. 30 | #' \url{https://gist.github.com/tim-salabim/2845fa90813fa25c18cf83f9b88cbde0} 31 | #' @format \code{sf feature collection MULTIPOLYGON} 32 | #' @source 33 | #' \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts} 34 | "franconia" 35 | 36 | #' Selected hiking trails in Franconia 37 | #' 38 | #' @details These hiking trails were downloaded on 06/04/2017 from 39 | #' \url{https://geoportal.bayern.de/bayernatlas} 40 | #' These data are published by the owner under Creative Commons Namensnennung 3.0 Deutschland, 41 | #' see \url{https://creativecommons.org/licenses/by/3.0/de/} for details. 42 | #' @format \code{sf feature collection MULTILINESTRING} 43 | #' @source 44 | #' Datenquelle: Bayerische Vermessungsverwaltung - `www.geodaten.bayern.de` 45 | #' \url{https://www.ldbv.bayern.de/produkte/weitere/opendata.html} 46 | "trails" 47 | 48 | -------------------------------------------------------------------------------- /R/plainView.R: -------------------------------------------------------------------------------- 1 | # if ( !isGeneric('plainView') ) { 2 | # setGeneric('plainView', function(x, ...) 3 | # standardGeneric('plainView')) 4 | # } 5 | # 6 | # #' View raster objects interactively without background map but in any CRS 7 | # #' 8 | # #' @description 9 | # #' This function is deprecated. 10 | # #' Pleasue use plainview::\code{\link[plainview]{plainView}} instead. 11 | # #' 12 | # #' @param x a \code{\link{raster}}* object 13 | # #' @param maxpixels integer > 0. Maximum number of cells to use for the plot. 14 | # #' If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting. 15 | # #' @param col.regions color (palette).See \code{\link[lattice]{levelplot}} for details. 16 | # #' @param at the breakpoints used for the visualisation. See 17 | # #' \code{\link[lattice]{levelplot}} for details. 18 | # #' @param na.color color for missing values. 19 | # #' @param legend either logical or a list specifying any of the components 20 | # #' decribed in the \code{colorkey} section of \link[lattice]{levelplot}. 21 | # #' @param verbose should some details be printed during the process 22 | # #' @param layer.name the name of the layer to be shown on the map 23 | # #' @param gdal logical. If TRUE (default) gdal_translate is used 24 | # #' to create the png file for display when possible. See details for further 25 | # #' information. 26 | # #' @param ... additional arguments passed on to repective functions. 27 | # #' See \code{\link{addRasterImage}}, \code{\link{addCircles}}, 28 | # #' \code{\link{addPolygons}}, \code{\link{addPolylines}} for details 29 | # #' 30 | # #' @export plainView 31 | # #' @name plainView 32 | # #' @rdname plainView 33 | # #' @aliases plainView,RasterLayer-method 34 | # #' @importFrom grDevices grey.colors 35 | # 36 | # ## RasterLayer ============================================================ 37 | # 38 | # setMethod('plainView', signature(x = 'RasterLayer'), 39 | # function(x, 40 | # maxpixels = mapviewGetOption("plainview.maxpixels"), 41 | # col.regions = mapviewGetOption("raster.palette")(256), 42 | # at, 43 | # na.color = mapviewGetOption("na.color"), 44 | # legend = TRUE, 45 | # verbose = mapviewGetOption("verbose"), 46 | # layer.name = deparse(substitute(x, 47 | # env = parent.frame())), 48 | # gdal = TRUE, 49 | # ...) { 50 | # 51 | # .Defunct(new = "plainview::plainView", package = "mapview") 52 | # 53 | # } 54 | # 55 | # ) 56 | # 57 | # 58 | # ## Raster Stack/Brick =========================================================== 59 | # #' @describeIn plainView \code{\link{stack}} / \code{\link{brick}} 60 | # #' 61 | # #' @param r integer. Index of the Red channel, between 1 and nlayers(x) 62 | # #' @param g integer. Index of the Green channel, between 1 and nlayers(x) 63 | # #' @param b integer. Index of the Blue channel, between 1 and nlayers(x) 64 | # 65 | # setMethod('plainView', signature(x = 'RasterStackBrick'), 66 | # function(x, r = 3, g = 2, b = 1, 67 | # na.color = mapviewGetOption("na.color"), 68 | # maxpixels = mapviewGetOption("plainview.maxpixels"), 69 | # layer.name = deparse(substitute(x, 70 | # env = parent.frame())), 71 | # ...) { 72 | # 73 | # .Defunct(new = "plainview::plainView", package = "mapview") 74 | # 75 | # } 76 | # 77 | # ) 78 | # 79 | # 80 | # 81 | # ## SpatialPixelsDataFrame ================================================= 82 | # #' @describeIn plainView \code{\link{SpatialPixelsDataFrame}} 83 | # #' 84 | # #' @param zcol attribute name or column number in attribute table 85 | # #' of the column to be rendered 86 | # #' 87 | # setMethod('plainView', signature(x = 'SpatialPixelsDataFrame'), 88 | # function(x, 89 | # zcol = 1, 90 | # ...) { 91 | # 92 | # .Defunct(new = "plainview::plainView", package = "mapview") 93 | # 94 | # } 95 | # ) 96 | # 97 | # 98 | # ## plainview ============================================================== 99 | # 100 | # if ( !isGeneric('plainview') ) { 101 | # setGeneric('plainview', function(...) 102 | # standardGeneric('plainview')) 103 | # } 104 | # 105 | # #' @describeIn plainView alias for ease of typing 106 | # #' @aliases plainview 107 | # #' @export plainview 108 | # 109 | # setMethod('plainview', signature('ANY'), 110 | # function(...) { 111 | # 112 | # .Defunct(new = "plainview::plainView", package = "mapview") 113 | # 114 | # } 115 | # ) 116 | # 117 | # 118 | -------------------------------------------------------------------------------- /R/popup.R: -------------------------------------------------------------------------------- 1 | # #' Create HTML strings for popups 2 | # #' 3 | # #' @description 4 | # #' These functions are deprecated. 5 | # #' Please use leafpop::\code{\link[leafpop]{popupTable}}, 6 | # #' leafpop::\code{\link[leafpop]{popupImage}} 7 | # #' and leafpop::\code{\link[leafpop]{popupGraph}} instead. 8 | # #' 9 | # #' @param x A \code{Spatial*} object. 10 | # #' @param zcol \code{numeric} or \code{character} vector indicating the columns 11 | # #' included in the output popup table. If missing, all columns are displayed. 12 | # #' @param row.numbers \code{logical} whether to include row numbers in the popup table. 13 | # #' @param feature.id \code{logical} whether to add 'Feature ID' entry to popup table. 14 | # #' 15 | # #' @export popupTable 16 | # #' @name popupTable 17 | # #' @rdname popup 18 | # popupTable = function(x, zcol, row.numbers = TRUE, feature.id = TRUE) { 19 | # .Defunct(new = "leafpop::popupTable", package = "mapview") 20 | # } 21 | # 22 | # 23 | # #' Create HTML strings for popups 24 | # #' 25 | # #' @param img A character \code{vector} of file path(s) or 26 | # #' web-URL(s) to any sort of image file(s). 27 | # #' @param src Whether the source is "local" (i.e. valid file path(s)) or 28 | # #' "remote" (i.e. valid URL(s)). 29 | # #' @param embed whether to embed the (local) images in the popup html as 30 | # #' base64 ecoded. Set this to TRUE if you want to save and share your map, unless 31 | # #' you want render many images, then set to FALSE and make sure to copy ../graphs 32 | # #' when copying the map to a different location. 33 | # #' @param ... further arguments passed on to underlying methods such as 34 | # #' height and width. 35 | # #' 36 | # #' @export popupImage 37 | # #' @name popupImage 38 | # #' @rdname popup 39 | # popupImage = function(img, src = c("local", "remote"), embed = FALSE, ...) { 40 | # .Defunct(new = "leafpop::popupImage", package = "mapview") 41 | # } 42 | # 43 | # 44 | # 45 | # #' Create HTML strings for popups 46 | # #' 47 | # #' @param graphs A \code{list} of figures associated with \code{x}. 48 | # #' @param type Output filetype, one of "png" (default), "svg" or "html". 49 | # #' @param width popup width in pixels. 50 | # #' @param height popup height in pixels. 51 | # #' 52 | # #' @export popupGraph 53 | # #' @name popupGraph 54 | # #' @rdname popup 55 | # popupGraph = function(graphs, type = c("png", "svg", "html"), 56 | # width = 300, height = 300, ...) { 57 | # .Defunct(new = "leafpop::popupGraph", package = "mapview") 58 | # } 59 | 60 | 61 | popupLayoutDependencies <- function() { 62 | list( 63 | htmltools::htmlDependency( 64 | "PopupTable", 65 | '0.0.1', 66 | system.file("htmlwidgets/lib/css", package = "mapview"), 67 | stylesheet = 'mapview-popup.css' 68 | )) 69 | } 70 | -------------------------------------------------------------------------------- /R/print.R: -------------------------------------------------------------------------------- 1 | printMapview = function (x) { 2 | 3 | ## normal htmlwidget printing for notebooks etc. 4 | ## set options fgb & georaster to FALSE!! 5 | if (!isTRUE(mapviewGetOption("fgb")) & !isTRUE(mapviewGetOption("georaster"))) { 6 | print(mapview2leaflet(x)) 7 | # invisible(x) 8 | return(invisible()) 9 | } 10 | 11 | ## convert to leaflet object 12 | x = mapview2leaflet(x) 13 | viewer = getOption("viewer") 14 | ide = get_ide() 15 | if (mapviewGetOption("viewer.suppress")) { 16 | viewer = NULL 17 | } 18 | if (!is.null(viewer)) { 19 | viewerFunc = function(url) { 20 | paneHeight = x$sizingPolicy$viewer$paneHeight 21 | if (identical(paneHeight, "maximize")) { 22 | paneHeight = -1 23 | } 24 | if (ide == "vscode") { 25 | # VSCode's viewer can't ignore cross-origin requests. Need to serve the 26 | # map so assests can be read, e.g. .fgb files. 27 | server <- servr::httd( 28 | dir = get_url_dir(url), 29 | verbose = FALSE, 30 | browser = FALSE 31 | ) 32 | url <- server$url 33 | 34 | } 35 | viewer(url, height = paneHeight) 36 | } 37 | } else { 38 | viewerFunc = function(url) { 39 | dir = get_url_dir(url) 40 | switch(ide, 41 | "rstudio" = if (mapviewGetOption("viewer.suppress")) { 42 | fl = file.path(dir, "index.html") 43 | utils::browseURL(fl) 44 | } else { 45 | servr::httd( 46 | dir = dir, 47 | verbose = FALSE 48 | ) 49 | }, 50 | "vscode" = servr::httd( 51 | dir = dir, 52 | verbose = FALSE 53 | ), 54 | # default 55 | servr::httd( 56 | dir = dir, 57 | verbose = FALSE 58 | ) 59 | ) 60 | } 61 | } 62 | htmltools::html_print( 63 | htmltools::as.tags(x, standalone = TRUE) 64 | , viewer = if (interactive()) viewerFunc 65 | ) 66 | invisible(x) 67 | } 68 | 69 | #' Method for printing mapview objects 70 | #' @param x a mapview object 71 | #' 72 | setMethod('print', signature(x = "mapview"), printMapview) 73 | 74 | #' Method for printing mapview objects (show) 75 | #' @param object a mapview object 76 | setMethod("show", signature(object = "mapview"), 77 | function(object) { 78 | print(object) 79 | } 80 | ) 81 | 82 | 83 | #' Print functions for mapview objects used in knitr 84 | #' 85 | #' @param x A mapview object 86 | #' @param ... further arguments passed on to \code{\link[knitr]{knit_print}} 87 | #' 88 | #' @exportS3Method knitr::knit_print 89 | knit_print.mapview = function(x, ...) { 90 | knitr::knit_print(mapview2leaflet(x), ...) 91 | } 92 | 93 | get_ide = function() { 94 | if (is_rstudio()) { 95 | return("rstudio") 96 | } else if (is_vscode()) { 97 | return("vscode") 98 | } else { 99 | "other" 100 | } 101 | } 102 | 103 | is_rstudio = function() { 104 | if (requireNamespace("rstudioapi", quietly = TRUE)) { 105 | rstudioapi::isAvailable() && rstudioapi::versionInfo()$mode != "vscode" 106 | } else { 107 | FALSE 108 | } 109 | } 110 | 111 | ## need to assign global variable .vsc 112 | if(getRversion() >= "2.15.1") utils::globalVariables(c(".vsc")) 113 | 114 | is_vscode = function() { 115 | # can we find .vsc$attach() ? 116 | exists(".vsc") && exists("attach", envir = .vsc) 117 | } 118 | 119 | get_url_dir <- function(url) gsub("file://|/index.html", "", url) 120 | -------------------------------------------------------------------------------- /R/shiny-mapview.R: -------------------------------------------------------------------------------- 1 | #' Render a mapview widget in shiny 2 | #' 3 | #' @param expr An expression that generates an HTML widget 4 | #' @param env The environment in which to evaluate expr 5 | #' @param quoted Is `expr` a quoted expression (with `quote()`)? 6 | #' This is useful if you want to save an expression in a variable 7 | #' 8 | #' @export 9 | #' 10 | renderMapview <- function(expr, env = parent.frame(), quoted = FALSE) { 11 | expr <- mapview2leaflet(expr) 12 | if (!quoted) 13 | expr = substitute(expr) 14 | htmlwidgets::shinyRenderWidget(expr, leafletOutput, env, 15 | quoted = TRUE) 16 | } 17 | 18 | #' Create a mapview UI element for use with shiny 19 | #' 20 | #' @param outputId Output variable to read from 21 | #' @param width,height the width and height of the map 22 | #' (see \code{\link[htmlwidgets]{shinyWidgetOutput}}) 23 | #' 24 | #' @export 25 | #' 26 | mapviewOutput <- function (outputId, width = "100%", height = 400) { 27 | htmlwidgets::shinyWidgetOutput(outputId, "leaflet", width, 28 | height, "leaflet") 29 | } 30 | -------------------------------------------------------------------------------- /R/sync.R: -------------------------------------------------------------------------------- 1 | # #' View two or more (possibly synchronised) mapview or leaflet maps 2 | # #' 3 | # #' @description 4 | # #' These functions are deprecated. 5 | # #' Please use leafsync::\code{\link[leafsync]{sync}} and 6 | # #' leafsync::\code{\link[leafsync]{latticeView}} instead. 7 | # #' 8 | # #' @param ... any number of mapview or leaflet objects or a list thereof 9 | # #' @param ncol how many columns should be plotted 10 | # #' @param sync whether to synchronise zoom and pan for certain elements. 11 | # #' Possible values are "all" (default) to sync all maps, "none" to disable 12 | # #' synchronisation or a list of panel numbers, e.g. \code{list(c(1, 3), c(2, 4))} 13 | # #' will synchronise panels 1 & 3 and panels 2 & 4. Panels are drawn from top right 14 | # #' to bottom left. 15 | # #' @param sync.cursor whether to show cursor position in synced panels (default TRUE). 16 | # #' @param no.initial.sync whether to sync the initial view (default TRUE). 17 | # #' 18 | # #' @export latticeView 19 | # #' @name latticeView 20 | # #' @aliases latticeView 21 | # #' 22 | # 23 | # latticeView <- function(..., 24 | # ncol = 2, 25 | # sync = "none", 26 | # sync.cursor = FALSE, 27 | # no.initial.sync = TRUE) { 28 | # 29 | # .Defunct(new = "leafsync::latticeView", package = "mapview") 30 | # 31 | # } 32 | # 33 | # #' @describeIn latticeView alias for ease of typing 34 | # #' @aliases latticeview 35 | # #' @export latticeview 36 | # latticeview <- function(...) { 37 | # .Defunct(new = "leafsync::latticeview", package = "mapview") 38 | # } 39 | # 40 | # #' @describeIn latticeView convenience function for syncing maps 41 | # #' @aliases sync 42 | # #' @export sync 43 | # sync <- function(..., 44 | # ncol = 2, 45 | # sync = "all", 46 | # sync.cursor = TRUE, 47 | # no.initial.sync = TRUE) { 48 | # 49 | # .Defunct(new = "leafsync::sync", package = "leafsync") 50 | # 51 | # } 52 | # 53 | -------------------------------------------------------------------------------- /R/viewRGB.R: -------------------------------------------------------------------------------- 1 | #' Red-Green-Blue map view of a multi-layered Raster object 2 | #' 3 | #' @description 4 | #' Make a Red-Green-Blue plot based on three layers (in a RasterBrick, RasterStack). 5 | #' Three layers (sometimes referred to as "bands" because they may represent 6 | #' different bandwidths in the electromagnetic spectrum) are combined such 7 | #' that they represent the red, green and blue channel. This function can 8 | #' be used to make 'true (or false) color images' from Landsat and other 9 | #' multi-band satellite images. Note, this text is plagiarized, i.e. copied 10 | #' from [raster::plotRGB()]. 11 | #' 12 | #' @param x a RasterBrick, RasterStack 13 | #' @param r integer. Index of the Red channel/band, between 1 and nlayers(x) 14 | #' @param g integer. Index of the Green channel/band, between 1 and nlayers(x) 15 | #' @param b integer. Index of the Blue channel/band, between 1 and nlayers(x) 16 | #' @param quantiles the upper and lower quantiles used for color stretching. If set to NULL, no stretching is applied. 17 | #' @param map the map to which the layer should be added 18 | #' @param maxpixels integer > 0. Maximum number of cells to use for the plot. 19 | #' If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting. 20 | #' @param map.types character spcifications for the base maps. 21 | #' see \url{https://leaflet-extras.github.io/leaflet-providers/preview/} 22 | #' for available options. 23 | #' @param na.color the color to be used for NA pixels 24 | #' @param layer.name the name of the layer to be shown on the map 25 | #' @param method Method used to compute 26 | #' values for the resampled layer that is passed on to leaflet. mapview does 27 | #' projection on-the-fly to ensure correct display and therefore needs to know 28 | #' how to do this projection. The default is 'bilinear' (bilinear interpolation), 29 | #' which is appropriate for continuous variables. The other option, 'ngb' 30 | #' (nearest neighbor), is useful for categorical variables. 31 | #' @param ... additional arguments passed on to \code{\link{mapView}} 32 | #' 33 | #' @author 34 | #' Tim Appelhans 35 | #' 36 | #' @examples 37 | #' if (interactive()) { 38 | #' library(raster) 39 | #' library(plainview) 40 | #' 41 | #' viewRGB(plainview::poppendorf, 4, 3, 2) # true-color 42 | #' viewRGB(plainview::poppendorf, 5, 4, 3) # false-color 43 | #' } 44 | #' 45 | #' @importFrom leafem addRasterRGB 46 | #' @importFrom raster projection 47 | #' @importFrom sf st_crs 48 | #' @export 49 | #' @docType methods 50 | #' @name viewRGB 51 | #' @rdname viewRGB 52 | #' @aliases viewRGB,RasterStackBrick-method 53 | 54 | viewRGB = function(x, r = 3, g = 2, b = 1, 55 | quantiles = c(0.02, 0.98), 56 | map = NULL, 57 | maxpixels = mapviewGetOption("mapview.maxpixels"), 58 | map.types = mapviewGetOption("basemaps"), 59 | na.color = mapviewGetOption("na.color"), 60 | layer.name = NULL, 61 | method = c("bilinear", "ngb"), 62 | ...) { 63 | 64 | if(!inherits(x, "Raster")) { # & !inherits(x, "stars")) { 65 | stop("'x' must be a Raster* object.") # or stars object.") 66 | } 67 | 68 | if (is.null(layer.name)) layer.name = makeLayerName(x, zcol = NULL, up = 1) 69 | 70 | method = match.arg(method) 71 | x = rasterCheckSize(x, maxpixels = maxpixels) 72 | x = rasterCheckAdjustProjection(x, method) 73 | projstring = if (inherits(x, "Raster")) { 74 | projection(x) 75 | } else { 76 | sf::st_crs(x)$proj4string 77 | } 78 | m = initMap(map, map.types, projstring) 79 | 80 | lyrs = paste(r, g, b, sep = ".") 81 | grp = paste(layer.name, lyrs, sep = "_") 82 | 83 | ext = createExtent(x) 84 | 85 | maxbytes = mapviewGetOption("raster.size") 86 | 87 | m = leafem::addRasterRGB(map = m, x = x, r = r, g = g, b = b, 88 | quantiles = quantiles, 89 | # maxpixels = maxpixels, 90 | na.color = na.color, 91 | method = method, 92 | group = grp, 93 | maxBytes = maxbytes, 94 | ...) 95 | m = mapViewLayersControl(map = m, 96 | map.types = map.types, 97 | names = grp) 98 | 99 | m = leaflet::addScaleBar(map = m, position = "bottomleft") 100 | m = leafem::addMouseCoordinates(m) 101 | m = leafem::addCopyExtent(m) 102 | m = leafem::addHomeButton(m, ext, group = grp) 103 | 104 | out = methods::new('mapview', object = list(x), map = m) 105 | 106 | return(out) 107 | 108 | } 109 | -------------------------------------------------------------------------------- /R/watch.R: -------------------------------------------------------------------------------- 1 | #' Start and/or stop automagic mapviewing of spatial objects in your workspace. 2 | #' 3 | #' @description 4 | #' Use these functions to enable automatic viewing of all spatial objects 5 | #' currently available in \code{env}. \code{mapviewWatcher} uses 6 | #' \link[later]{later} to set up a watcher function that continuously monitors 7 | #' \code{env} for spatial objects and refreshes the viewer/browser in case 8 | #' the list of spatial objects changes. 9 | #' \cr 10 | #' \cr 11 | #' \code{startWatching} and \code{stopWatching} are convenience functions to 12 | #' start and stop watching, respectively. 13 | #' 14 | #' @details 15 | #' \code{mapviewWatcher} uses \code{\link{identical}} and hence 16 | #' will redraw even if e.g. the attributes of a spatial object are changed only 17 | #' slightly. By default \code{mapviewWatcher} watches the \code{.GlobalEnv} but 18 | #' this can be changed to another environment. Whether watching is turned on is 19 | #' controlled by \code{mapviewGetOption("watch")}. In order to enable watching it 20 | #' needs to be set to \code{mapviewOptions(watch = TRUE)} 21 | #' (default is \code{FALSE}) and the watcher needs to be initiated by calling 22 | #' \code{mapviewWatcher()} once. To switch watching off it is sufficient to set 23 | #' \code{mapviewOptions(watch = FALSE)}. 24 | #' 25 | #' @param env the environment that is being watched (default is \code{.GlobalEnv}). 26 | #' @param ... currently not used. 27 | #' 28 | #' @examples 29 | #' if (interactive()) { 30 | #' library(mapview) 31 | #' 32 | #' ## start the watcher 33 | #' mapview::startWatching() 34 | #' 35 | #' ## load some data and watch the automatic visualisation 36 | #' fran = mapview::franconia 37 | #' brew = mapview::breweries 38 | #' 39 | #' ## stop the watcher 40 | #' mapview::stopWatching() 41 | #' 42 | #' ## loading or removing things now will not trigger a view update 43 | #' rm(brew) 44 | #' trls = mapview::trails 45 | #' 46 | #' ## re-starting the viewer will re-draw whatever is currently available 47 | #' mapview::startWatching() 48 | #' 49 | #' ## watcher can also be stopped via mapviewOptions 50 | #' mapviewOptions(watch = FALSE) 51 | #' 52 | #' rm(trls) 53 | #' 54 | #' } 55 | #' 56 | #' @export 57 | #' @rdname mapviewWatcher 58 | mapviewWatcher = function(env = .GlobalEnv, ...) { 59 | 60 | if (!requireNamespace("later", quietly = TRUE)) { 61 | stop( 62 | "Please install.packages('later') to allow mapview to watch your workspace" 63 | , call. = FALSE 64 | ) 65 | } 66 | 67 | last_value = NULL 68 | 69 | dir <- tempfile() 70 | dir.create(dir) 71 | htmlFile <- file.path(dir, "index.html") 72 | 73 | mv_watch = function() { 74 | if (!mapviewGetOption("watch")) return(invisible()) 75 | spatdat_lst = getSpatialData(env = env) 76 | if (length(spatdat_lst) > 0 && !identical(spatdat_lst, last_value)) { 77 | m = mapview::mapView(spatdat_lst) 78 | mapview::mapshot(m, htmlFile, selfcontained = FALSE) 79 | 80 | # viewer <- getOption("viewer") 81 | # if (!is.null(viewer)) { 82 | # viewer(htmlFile) 83 | # } else { 84 | # utils::browseURL(htmlFile) 85 | # } 86 | last_value <<- spatdat_lst 87 | } 88 | 89 | later::later(mv_watch, 0.25) 90 | } 91 | 92 | ## initiate the watcher 93 | mv_watch() 94 | return(htmlFile) 95 | } 96 | 97 | #' @export 98 | #' @describeIn mapviewWatcher start watching 99 | startWatching = function(env = .GlobalEnv, ...) { 100 | mapviewOptions(watch = TRUE) 101 | fl = mapviewWatcher(env = env) 102 | if (!file.exists(fl)) { 103 | mapshot(mapview() + "egg", url = fl) 104 | } 105 | towatch = dirname(fl) 106 | servr::httw( 107 | dir = towatch 108 | , pattern = ".html" 109 | , verbose = FALSE 110 | ) 111 | } 112 | 113 | #' @export 114 | #' @describeIn mapviewWatcher stop watching 115 | stopWatching = function(env = .GlobalEnv, ...) { 116 | mapviewOptions(watch = FALSE) 117 | } 118 | 119 | 120 | ## helper 121 | getSpatialData = function(env = .GlobalEnv) { 122 | dat = ls(envir = env, sorted = FALSE) 123 | cls = lapply(lapply(dat, get), class) 124 | 125 | ## sf 126 | sf_idx = grep("sf", cls) 127 | sf_dat = as.list(dat[sf_idx]) 128 | names(sf_dat) = dat[sf_idx] 129 | 130 | ## sp 131 | sp_idx = grep("Spatial", cls) 132 | sp_dat = as.list(dat[sp_idx]) 133 | names(sp_dat) = dat[sp_idx] 134 | 135 | # stars 136 | st_idx = grep("stars", cls) 137 | st_dat = as.list(dat[st_idx]) 138 | names(st_dat) = dat[st_idx] 139 | 140 | ## raster - doesn't work currently! fix by converting to stars internally 141 | # rs_idx = grep("Raster", cls) 142 | # rs_dat = as.list(dat[rs_idx]) 143 | # names(rs_dat) = dat[rs_idx] 144 | 145 | ## combine and get 146 | spatdat = Filter(Negate(is.null), c(sf_dat, sp_dat, st_dat)) #, rs_dat)) 147 | 148 | lapply(spatdat, get) 149 | } 150 | 151 | -------------------------------------------------------------------------------- /R/xy.R: -------------------------------------------------------------------------------- 1 | # make interactive scatter plots 2 | 3 | xyView = function(x, y, data, type = "p", grid = TRUE, aspect = 1, label, crs = NA, ...) { 4 | 5 | if (!missing(data)) { 6 | # nm = "data" #deparse(substitute(data)) 7 | data[[y]] = data[[y]] * aspect 8 | data = sf::st_as_sf(data, coords = c(x, y), remove = FALSE, crs = crs) 9 | } else if (!missing(x) & missing(y)) { 10 | y = x * aspect 11 | x = seq_along(y) 12 | data = sf::st_as_sf( 13 | data.frame(x = x, y = y), 14 | coords = c("x", "y"), 15 | remove = FALSE 16 | ) 17 | # layer.name = "data" 18 | # stop("need both x and y if data is missing") 19 | } else { 20 | data = sf::st_as_sf( 21 | data.frame(x = x, y = y * aspect), 22 | coords = c("x", "y"), 23 | remove = FALSE, 24 | crs = crs 25 | ) 26 | # nm = "data" 27 | } 28 | 29 | if (type == "l") { 30 | data = sf::st_sfc( 31 | sf::st_cast( 32 | sf::st_combine( 33 | data 34 | ), 35 | to = "LINESTRING" 36 | )[[1]], 37 | crs = crs 38 | ) 39 | } 40 | 41 | xlab = sf::st_coordinates(data)[, "X"] 42 | ylab = sf::st_coordinates(data)[, "Y"] / aspect 43 | # labs = lapply(seq(xlab), function(i) paste(xlab[i], ylab[i], sep = ", ")) 44 | 45 | if (grid) out = xyGrid(data, aspect) else out = NULL 46 | out = mapView( 47 | data, 48 | map = out, 49 | highlight = NULL, 50 | label = label, 51 | ... 52 | ) 53 | return(out) 54 | } 55 | 56 | 57 | xyGrid = function(x, aspect = 1) { 58 | # x = iris_sf 59 | 60 | xrange = extendLimits( 61 | c(sf::st_bbox(x)[["xmin"]], 62 | sf::st_bbox(x)[["xmax"]]) 63 | ) 64 | yrange = extendLimits( 65 | c(sf::st_bbox(x)[["ymin"]], 66 | sf::st_bbox(x)[["ymax"]]) 67 | ) 68 | 69 | xticks = pretty(xrange) 70 | xstep = unique(diff(xticks)) 71 | yticks = pretty(yrange) 72 | ystep = unique(diff(yticks)) 73 | 74 | step = min(c(xstep, ystep)) 75 | 76 | xticks = c( 77 | xrange[1] - step * 0.3, 78 | xticks[2:(length(xticks)-1)], 79 | xrange[2] + step * 0.3 80 | ) 81 | 82 | yticks = c( 83 | yrange[1] - step * 0.3, 84 | yticks[2:(length(yticks)-1)], 85 | yrange[2] + step * 0.3 86 | ) 87 | 88 | hline = lapply(yticks, function(i) { 89 | sf::st_linestring( 90 | rbind(cbind(xticks[1], i), cbind(xticks[length(xticks)], i)) 91 | ) 92 | }) 93 | 94 | vline = lapply(xticks, function(i) { 95 | sf::st_linestring( 96 | cbind(rbind(i, i), rbind(yticks[1], yticks[length(yticks)])) 97 | ) 98 | }) 99 | 100 | hlines = sf::st_sfc(hline[2:(length(hline)-1)], crs = sf::st_crs(x)) 101 | vlines = sf::st_sfc(vline[2:(length(vline)-1)], crs = sf::st_crs(x)) 102 | 103 | hlabs = yticks[2:(length(yticks)-1)] * (1 / aspect) 104 | vlabs = xticks[2:(length(xticks)-1)] 105 | 106 | hout = mapView( 107 | hlines, 108 | layer.name = "y_grid", 109 | color = "black", 110 | label = as.character(hlabs), 111 | lwd = 1, 112 | alpha = 0.5, 113 | homebutton = FALSE 114 | )@map 115 | 116 | vout = mapView( 117 | vlines, 118 | map = hout, 119 | layer.name = "x_grid", 120 | color = "black", 121 | label = as.character(vlabs), 122 | lwd = 1, 123 | alpha = 0.5, 124 | homebutton = FALSE 125 | )@map 126 | 127 | out = leaflet::addLabelOnlyMarkers( 128 | map = vout, 129 | lng = rep(xticks[1], length(hlabs)), 130 | lat = hlabs * aspect, 131 | label = as.character(hlabs), 132 | group = "y_grid", 133 | labelOptions = leaflet::labelOptions( 134 | noHide = TRUE, 135 | direction = "left", 136 | textOnly = TRUE, 137 | offset = c(-5, 0), 138 | opacity = 0.5 139 | ) 140 | ) 141 | 142 | out = leaflet::addLabelOnlyMarkers( 143 | map = out, 144 | lng = vlabs, 145 | lat = rep(yticks[1], length(vlabs)), 146 | label = as.character(vlabs), 147 | group = "x_grid", 148 | labelOptions = leaflet::labelOptions( 149 | noHide = TRUE, 150 | direction = "bottom", 151 | textOnly = TRUE, 152 | offset = c(0, -10), 153 | opacity = 0.5 154 | ) 155 | ) 156 | 157 | return(out) 158 | } 159 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | ```{r setup, include = FALSE} 6 | knitr::opts_chunk$set( 7 | collapse = TRUE, 8 | eval = FALSE, 9 | comment = "#>", 10 | out.width = "100%" 11 | ) 12 | ``` 13 | 14 | # mapview 15 | 16 | 17 | [![R-CMD-check](https://github.com/r-spatial/mapview/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatial/mapview/actions/workflows/R-CMD-check.yaml) 18 | [![cran checks](https://badges.cranchecks.info/worst/mapview.svg)](https://cran.r-project.org/web/checks/check_results_mapview.html) 19 | ![monthly](https://cranlogs.r-pkg.org/badges/mapview) 20 | ![total](https://cranlogs.r-pkg.org/badges/grand-total/mapview) 21 | [![CRAN](https://www.r-pkg.org/badges/version/mapview?color=009999)](https://cran.r-project.org/package=mapview) 22 | [![License](https://img.shields.io/badge/license-GPL%20%28%3E=%203%29-lightgrey.svg?style=flat)](https://www.gnu.org/licenses/gpl-3.0.html) 23 | [![Codecov test coverage](https://codecov.io/gh/r-spatial/mapview/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/mapview) 24 | [![status](https://tinyverse.netlify.com/badge/mapview)](https://CRAN.R-project.org/package=mapview) 25 | 26 | 27 | ### Interactive viewing of spatial data in R 28 | 29 | 30 | 31 | **mapview** provides functions to very quickly and conveniently create interactive visualisations of spatial data. It's main goal is to fill the gap of quick (not presentation grade) interactive plotting to examine and visually investigate both aspects of spatial data, the geometries and their attributes. It can also be considered a data-driven API for the [**leaflet**](https://cran.r-project.org/package=leaflet) package as it will automatically render correct map types, depending on the type of the data (points, lines, polygons, raster). In addition, it makes use of some advanced rendering functionality that will enable viewing of much larger data than is possible with **leaflet**. Furthermore, if you're a fan of [**mapdeck**](https://cran.r-project.org/package=mapdeck) (which you should!), you can choose to use it as the rendering platform instead of **leaflet** by setting `mapviewOptions(platform = "mapdeck")`. 32 | 33 | The main user relevant functions are: 34 | 35 | * `mapview` - view (multiple) spatial objects on a set of background maps 36 | * `viewExtent` - view extent / bounding box of spatial objects 37 | * `viewRGB` - view RGB true- or false-color images of raster objects 38 | * `mapshot` - easily save maps (including leaflet maps) as `html` and/or `png` 39 | (or other image formats) 40 | 41 | Functions that have been deprecated/deleted recently: 42 | 43 | * `addHomeButton` - deprecated, use package [leafem](https://CRAN.R-project.org/package=leafem) instead. 44 | * `addLogo` - deprecated, use package [leafem](https://CRAN.R-project.org/package=leafem) instead. 45 | * `addFeatures` - deprecated, use package [leafem](https://CRAN.R-project.org/package=leafem) instead. 46 | * `addMouseCoordinates` - deprecated, use package [leafem](https://CRAN.R-project.org/package=leafem) instead. 47 | * `addExtent` - deprecated, use package [leafem](https://CRAN.R-project.org/package=leafem) instead. 48 | * `addImageQuery` - deprecated, use package [leafem](https://CRAN.R-project.org/package=leafem) instead. 49 | * `latticeView` & `sync` - deprecated, use package [leafsync](https://CRAN.R-project.org/package=leafsync) instead. 50 | * `slideView` - deprecated, use package [slideview](https://CRAN.R-project.org/package=slideview) instead. 51 | * `cubeView` - deprecated, use package [cubeview](https://CRAN.R-project.org/package=cubeview) instead. 52 | * `plainview` - deprecated, use package [plainview](https://CRAN.R-project.org/package=plainview) instead. 53 | * `popupTable`, `popupGraph` & `popupImage` - deprecated, use package [leafpop](https://CRAN.R-project.org/package=leafpop) instead. 54 | * `addLargeFeatures` - use [leafgl](https://CRAN.R-project.org/package=leafgl)`::addGL*` functions instead. 55 | 56 | Objects of the following spatial classes are supported: 57 | 58 | * [sf](https://cran.r-project.org/package=sf) 59 | * [raster](https://cran.r-project.org/package=raster) (Layer, Stack, Brick and SpatialPixels* / SpatialGridDataFrame) 60 | * [stars](https://cran.r-project.org/package=stars) 61 | * [sp](https://cran.r-project.org/package=sp) (Points, Polygons, Lines and their DataFrame version) 62 | * [satellite](https://cran.r-project.org/package=satellite) 63 | 64 | 65 | ## Installation 66 | 67 | For CRAN release version of **mapview** use 68 | 69 | 70 | ```{r, eval=FALSE} 71 | install.packages("mapview") 72 | ``` 73 | 74 | 75 | To install the development version you can install the [remotes](https://cran.r-project.org/package=remotes) package. 76 | 77 | **NOTE:** As of version 2.9.1 development will happen on the `master` branch. Please consider the `develop` branch obsolete. 78 | 79 | ```{r, eval=FALSE} 80 | remotes::install_github("r-spatial/mapview") 81 | ``` 82 | 83 | 84 | ## Usage 85 | 86 | The most basic call 87 | 88 | ```{r, eval=FALSE} 89 | mapview(breweries) 90 | ``` 91 | 92 | will produce a web map visualisation of the breweries data with the following components: 93 | 94 | ![](man/figures/basic_small.png) 95 | 96 | ## Contact 97 | 98 | Please file bug reports and feature requests at https://github.com/r-spatial/mapview/issues 99 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://r-spatial.github.io/mapview/ 2 | template: 3 | bootstrap: 5 4 | 5 | -------------------------------------------------------------------------------- /data/breweries.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/data/breweries.rda -------------------------------------------------------------------------------- /data/franconia.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/data/franconia.rda -------------------------------------------------------------------------------- /data/trails.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/data/trails.rda -------------------------------------------------------------------------------- /inst/extdata/kiliNDVI.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/inst/extdata/kiliNDVI.tif -------------------------------------------------------------------------------- /inst/htmlwidgets/lib/css/mapview-popup.css: -------------------------------------------------------------------------------- 1 | /* table class css */ 2 | table.mapview-popup { 3 | overflow: scroll; 4 | width: auto; 5 | height: auto; 6 | border-collapse: collapse; 7 | } 8 | 9 | /* 10 | table.mapview-popup tr:first-child td { 11 | background: #A8E6A8; 12 | } 13 | */ 14 | 15 | table.mapview-popup tr:nth-child(even) { 16 | background: #D1E0FF; 17 | } 18 | 19 | table.mapview-popup tr:nth-child(odd) { 20 | background: #ebf1ff; 21 | } 22 | 23 | table.mapview-popup, th, td { 24 | border-bottom: 1px solid #ffffff; 25 | } 26 | 27 | /* 28 | table.tab tr:hover { 29 | background: #00ffff; 30 | } 31 | */ 32 | 33 | 34 | /* general leaflet popup css '*/ 35 | .leaflet-popup-content { 36 | margin: 1px 1px 1px 1px; 37 | line-height: 1.5; 38 | overflow-y: auto; 39 | overflow-x: scoll; 40 | } 41 | 42 | .leaflet-container a.leaflet-popup-close-button { 43 | position: absolute; 44 | top: 0; 45 | right: -20px; 46 | padding: 3px 0 0 0; 47 | text-align: center; 48 | width: 18px; 49 | height: 14px; 50 | font: 16px/14px Tahoma, Verdana, sans-serif; 51 | font-weight: bold; 52 | color: #c3c3c3; 53 | text-decoration: none; 54 | background: transparent; 55 | } 56 | 57 | .leaflet-container a.leaflet-popup-close-button:hover { 58 | color: #999; 59 | } 60 | 61 | .leaflet-popup-content-wrapper, .leaflet-popup-tip { 62 | padding: 1px; 63 | -webkit-border-radius: 0; 64 | border-radius: 0; 65 | background: #ffffff; /*#4c4c4c;*/ 66 | box-shadow: 0 3px 14px rgba(0,0,0,0.4); 67 | } 68 | 69 | 70 | div::-webkit-scrollbar { 71 | width: 5px; 72 | height: 5px; 73 | } 74 | div::-webkit-scrollbar-button { 75 | width: 0; 76 | height: 0; 77 | } 78 | div::-webkit-scrollbar-thumb { 79 | background: #666666; 80 | border: 0 none #ffffff; 81 | border-radius: 0; 82 | } 83 | div::-webkit-scrollbar-thumb:hover { 84 | background: #333333; 85 | } 86 | div::-webkit-scrollbar-thumb:active { 87 | background: #333333; 88 | } 89 | div::-webkit-scrollbar-track { 90 | background: #e1e1e1; 91 | border: 0 none #ffffff; 92 | border-radius: 50px; 93 | } 94 | div::-webkit-scrollbar-track:hover { 95 | background: #e1e1e1; 96 | } 97 | div::-webkit-scrollbar-track:active { 98 | background: #e1e1e1; 99 | } 100 | div::-webkit-scrollbar-corner { 101 | background: transparent; 102 | } 103 | -------------------------------------------------------------------------------- /inst/htmlwidgets/lib/css/mapview.css: -------------------------------------------------------------------------------- 1 | .leaflet-control br {clear: both;} 2 | -------------------------------------------------------------------------------- /inst/templates/popup-graph.brew: -------------------------------------------------------------------------------- 1 | 2 | 3 | 143 | 144 | 145 | 146 |
147 | 148 | 149 | <%=pop%> 150 | 151 | 152 |
153 | 154 | 155 | -------------------------------------------------------------------------------- /inst/templates/popup.brew: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | <%=pop%> 12 | 13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /inst/tinytest/test-color.R: -------------------------------------------------------------------------------- 1 | library(mapview) 2 | 3 | ### col2Hex ----- 4 | expect_equal(mapview:::col2Hex("black"), "#000000") 5 | expect_equal(mapview:::col2Hex("black", alpha = TRUE), "#000000FF") 6 | 7 | ### standardColor ----- 8 | expect_equal(mapview:::standardColor(breweries), "#333333") 9 | expect_equal(mapview:::standardColor(trails), "#6666ff") 10 | 11 | ### luminence ----- 12 | expect_equal(mapview:::luminence("black"), 0) 13 | expect_equal(mapview:::luminence("white"), 1) 14 | -------------------------------------------------------------------------------- /inst/tinytest/test-mapviewControls.R: -------------------------------------------------------------------------------- 1 | library(mapview) 2 | 3 | ### isAvailableInLeaflet() ----- 4 | avl = mapview:::isAvailableInLeaflet() 5 | 6 | expect_true(avl$lab) 7 | expect_true(avl$scl) 8 | 9 | 10 | ### mapview2leaflet ----- 11 | m = mapview(breweries) 12 | expect_true(inherits(m, "mapview")) 13 | 14 | l = mapview:::mapview2leaflet(m) 15 | expect_true(inherits(l, c("leaflet", "htmlwidget"))) 16 | 17 | 18 | ### getSimpleClass ----- 19 | library(plainview) 20 | 21 | expect_equal(mapview:::getSimpleClass(leaflet::breweries91), "vec") # sf 22 | expect_equal(mapview:::getSimpleClass(plainview::poppendorf), "rst") # raster 23 | expect_equal(mapview:::getSimpleClass(franconia), "vec") # sp 24 | 25 | ### makeLabels ----- 26 | expect_equal(mapview:::makeLabels(sf::st_geometry(breweries)[[1]]), "1") 27 | expect_equal(mapview:::makeLabels(head(sf::st_geometry(breweries))), 28 | as.character(1:6)) 29 | expect_equal(mapview:::makeLabels(franconia), rownames(franconia)) 30 | expect_equal(mapview:::makeLabels(franconia, zcol = "district"), 31 | franconia[["district"]]) 32 | 33 | ### makeLabelsSP ----- 34 | expect_equal(length(mapview:::makeLabelsSP(leaflet::breweries91$brewery)), 35 | nrow(leaflet::breweries91@data)) 36 | expect_true(inherits(mapview:::makeLabelsSP(leaflet::breweries91$founded), "character")) 37 | 38 | ### getFeatureIds ----- 39 | expect_equal(mapview:::getFeatureIds(franconia), row.names(franconia)) 40 | expect_equal(mapview:::getFeatureIds(leaflet::gadmCHE), row.names(leaflet::gadmCHE)) 41 | expect_equal(mapview:::getFeatureIds(sf::st_geometry(breweries)), 42 | 1:length(sf::st_geometry(breweries))) 43 | 44 | ### createExtent ----- 45 | expect_true(inherits(mapview:::createExtent(breweries), "Extent")) 46 | 47 | ### isMultiFeature ----- 48 | expect_equal(mapview:::isMultiFeature(sf::st_geometry(franconia)[[1]]), TRUE) 49 | expect_equal(mapview:::isMultiFeature(sf::st_geometry(breweries)[[1]]), FALSE) 50 | expect_false(mapview:::isMultiFeature("Test")) 51 | 52 | ### getSFClass ----- 53 | expect_equal(mapview:::getSFClass(breweries), "sf") 54 | expect_equal(mapview:::getSFClass(sf::st_geometry(franconia)), "sfc_MULTIPOLYGON") 55 | expect_equal(mapview:::getSFClass(sf::st_geometry(breweries)[[1]]), "POINT") 56 | 57 | ### getGeometryType ----- 58 | expect_true(inherits(mapview:::getGeometryType(franconia), "character")) 59 | expect_equal(mapview:::getGeometryType(breweries), "pt") 60 | expect_equal(mapview:::getGeometryType(sf::st_geometry(breweries)), "pt") 61 | expect_equal(mapview:::getGeometryType(trails), "ln") 62 | expect_equal(mapview:::getGeometryType(franconia), "pl") 63 | 64 | ### lineWidth ----- 65 | expect_equal(typeof(mapview:::lineWidth(franconia)), "double") 66 | expect_equal(mapview:::lineWidth(trails), 2) 67 | expect_equal(mapview:::lineWidth(franconia), 0.5) 68 | 69 | ### regionOpacity ----- 70 | expect_equal(typeof(mapview:::regionOpacity(franconia)), "double") 71 | expect_equal(mapview:::regionOpacity(trails), 1) 72 | expect_equal(mapview:::regionOpacity(franconia), 0.6) 73 | 74 | ### basemaps ----- 75 | expect_equal(typeof(mapview:::basemaps("#0000ff")), "character") 76 | expect_equal(mapview:::basemaps("black")[1], "CartoDB.Positron") 77 | expect_equal(mapview:::basemaps("white")[1], "CartoDB.DarkMatter") 78 | 79 | ### getProjection ----- 80 | expect_equal(typeof(mapview:::getProjection(franconia)), "character") 81 | 82 | ### createFileId ----- 83 | expect_equal(typeof(mapview:::createFileId()), "character") 84 | expect_equal(nchar(mapview:::createFileId(8)), 8) 85 | 86 | ### extendLimits ----- 87 | expect_equal(length(mapview:::extendLimits(c(1, 10))), 2) 88 | expect_equal(mapview:::extendLimits(c(1, 10)), c(0.37, 10.63)) 89 | expect_equal(typeof(mapview:::extendLimits(c(1, 10))), "double") 90 | 91 | ### circleRadius ----- 92 | expect_equal(length(mapview:::circleRadius(breweries)), 1) 93 | expect_equal(length(mapview:::circleRadius(breweries, "founded")), nrow(breweries)) 94 | expect_equal(typeof(mapview:::circleRadius(breweries, "founded")), "double") 95 | expect_equal(max(mapview:::circleRadius(breweries, "founded", max.rad = 22)), 22) 96 | expect_equal(min(mapview:::circleRadius(breweries, "founded", min.rad = 2)), 2) # NAs will have radius 2!! 97 | 98 | ### extentOverlap ----- 99 | expect_true(suppressMessages(mapview:::extentOverlap(breweries, franconia))) 100 | expect_false(suppressMessages(mapview:::extentOverlap(franconia[1, ], franconia[2, ]))) 101 | 102 | ### makeLayerName ----- 103 | expect_equal(typeof(mapview:::makeLayerName(franconia)), "character") 104 | 105 | ### makeListLayerNames ----- 106 | expect_equal(typeof(mapview:::makeListLayerNames(list(franconia, breweries), "test")), "list") 107 | expect_equal(mapview:::makeListLayerNames(list(f = franconia, b = breweries), "test"), 108 | list("f", "b")) 109 | 110 | ### paneName ----- 111 | expect_equal(mapview:::paneName(breweries), "point") 112 | 113 | ### zIndex ----- 114 | expect_equal(mapview:::zIndex(franconia), 420) 115 | 116 | ### useCanvas ----- 117 | expect_false(mapview:::useCanvas(breweries)) 118 | 119 | ### is_literally_false ---- 120 | expect_true(mapview:::is_literally_false(FALSE)) 121 | tst = NULL 122 | expect_false(mapview:::is_literally_false(tst)) 123 | -------------------------------------------------------------------------------- /man/breweries.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapview-package.R 3 | \docType{data} 4 | \name{breweries} 5 | \alias{breweries} 6 | \title{Selected breweries in Franconia} 7 | \format{ 8 | \code{sf feature collection POINT} 9 | } 10 | \usage{ 11 | breweries 12 | } 13 | \description{ 14 | Selected breweries in Franconia 15 | } 16 | \details{ 17 | This dataset contains selected breweries in Franconia. It is partly a 18 | subset of a larger database that was compiled by students at the 19 | University of Marburg for a seminar called 20 | "The Geography of Beer: sustainability in the food industry" 21 | and partly consists of breweries downloaded from 22 | \url{https://www.bierwandern.de/inhalt/brauereiliste.html} with the kind permission 23 | of Rainer Kastl. Note that use of these data is restricted to non-commercial use 24 | and that they are explicitly excluded from the GPL license that mapview is licensed under. 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/figures/basic_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/man/figures/basic_small.png -------------------------------------------------------------------------------- /man/franconia.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapview-package.R 3 | \docType{data} 4 | \name{franconia} 5 | \alias{franconia} 6 | \title{Administrative district borders of Franconia} 7 | \format{ 8 | \code{sf feature collection MULTIPOLYGON} 9 | } 10 | \source{ 11 | \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts} 12 | } 13 | \usage{ 14 | franconia 15 | } 16 | \description{ 17 | Administrative district borders of Franconia 18 | } 19 | \details{ 20 | The NUTS_2013_01M_SH.zip archive was downloaded on 23/03/2017 from 21 | \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts}. 22 | \url{https://gist.github.com/tim-salabim/2845fa90813fa25c18cf83f9b88cbde0} 23 | } 24 | \keyword{datasets} 25 | -------------------------------------------------------------------------------- /man/knit_print.mapview.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.R 3 | \name{knit_print.mapview} 4 | \alias{knit_print.mapview} 5 | \title{Print functions for mapview objects used in knitr} 6 | \usage{ 7 | \method{knit_print}{mapview}(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A mapview object} 11 | 12 | \item{...}{further arguments passed on to \code{\link[knitr]{knit_print}}} 13 | } 14 | \description{ 15 | Print functions for mapview objects used in knitr 16 | } 17 | -------------------------------------------------------------------------------- /man/mapshot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapshot.R 3 | \name{mapshot} 4 | \alias{mapshot} 5 | \alias{mapshot2} 6 | \title{Save mapview or leaflet map as HTML and/or image using webshot} 7 | \usage{ 8 | mapshot( 9 | x, 10 | url = NULL, 11 | file = NULL, 12 | remove_controls = c("zoomControl", "layersControl", "homeButton", "scaleBar", 13 | "drawToolbar", "easyButton"), 14 | ... 15 | ) 16 | 17 | mapshot2( 18 | x, 19 | url = NULL, 20 | file = NULL, 21 | remove_controls = c("zoomControl", "layersControl", "homeButton", "scaleBar", 22 | "drawToolbar", "easyButton", "control"), 23 | ... 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{\code{mapview} or \code{leaflet} object (or any other hmtlwidget).} 28 | 29 | \item{url}{Output \code{.html} file. If not supplied and 'file' is specified, 30 | a temporary index file will be created.} 31 | 32 | \item{file}{Output \code{.png}, \code{.pdf}, or \code{.jpeg} file.} 33 | 34 | \item{remove_controls}{\code{character} vector of control buttons to be removed 35 | from the map when saving to file. Any combination of 36 | \code{"zoomControl"}, \code{"layersControl"}, \code{"homeButton"}, \code{"scaleBar"}, \code{"drawToolbar"}, 37 | \code{"easyButton"}. If set to \code{NULL} nothing will be removed. Ignored if \code{x} 38 | is not a mapview or leaflet map.} 39 | 40 | \item{...}{Further arguments passed on to \code{\link[htmlwidgets]{saveWidget}} 41 | and/or \code{\link[webshot2]{webshot}}.} 42 | } 43 | \description{ 44 | Save a mapview or leaflet map as \code{.html} index file or \code{.png}, 45 | \code{.pdf}, or \code{.jpeg} image. 46 | } 47 | \details{ 48 | mapshot uses \code{\link[webshot]{webshot}} from the webshot package. 49 | mapshot2 uses \code{\link[webshot2]{webshot}} from the webshot2 package. 50 | 51 | mapshot can be used to save both leaflet and mapview maps as html or png 52 | files or both. In theory, it should also work for any and all other htmlwidgets 53 | but has not been tested extensively for other htmlwidgets. 54 | 55 | In case you want to save larger maps mapshot is likely to fail. You can try 56 | setting \code{selfcontained = FALSE} to avoid errors and create a valid 57 | local html file. 58 | 59 | mapshot2 uses \code{\link[htmlwidgets]{saveWidget}} and \code{\link[webshot2]{webshot}} 60 | to save maps as \code{.html} and/or \code{.png|.jpg} files, respectively. 61 | \code{\link[webshot2]{webshot}} assumes a findable installation of some Chrome 62 | browser variant on your system. If you see the the following error: 63 | 64 | \code{ 65 | `google-chrome` and `chromium-browser` were not found. 66 | Try setting the CHROMOTE_CHROME environment variable or adding one of these 67 | executables to your PATH. 68 | } 69 | 70 | it means that \code{\link[chromote]{find_chrome}} cannot find a Chrome based 71 | browser in your system. Please see 72 | \url{https://github.com/rstudio/chromote#specifying-which-browser-to-use} 73 | for more details. 74 | } 75 | \section{Functions}{ 76 | \itemize{ 77 | \item \code{mapshot()}: Save mapview or leaflet map as HTML and/or image using webshot 78 | 79 | \item \code{mapshot2()}: Save mapview or leaflet map as HTML and/or image using webshot2 80 | 81 | }} 82 | \examples{ 83 | \dontrun{ 84 | library(utils) 85 | 86 | m = mapview(breweries) 87 | html_fl = tempfile(fileext = ".html") 88 | png_fl = tempfile(fileext = ".png") 89 | 90 | ## create standalone .html 91 | mapshot(m, url = html_fl) 92 | browseURL(html_fl) 93 | 94 | ## create standalone .png; temporary .html is removed automatically unless 95 | ## 'remove_url = FALSE' is specified 96 | mapshot(m, file = png_fl) 97 | browseURL(png_fl) 98 | mapshot(m, file = png_fl, 99 | remove_controls = c("homeButton", "layersControl")) 100 | browseURL(png_fl) 101 | 102 | ## create .html and .png 103 | mapshot(m, url = html_fl, file = png_fl) 104 | browseURL(png_fl) 105 | browseURL(html_fl) 106 | } 107 | 108 | \dontrun{ 109 | library(utils) 110 | 111 | m = mapview(breweries) 112 | html_fl = tempfile(fileext = ".html") 113 | png_fl = tempfile(fileext = ".png") 114 | 115 | ## create standalone .html 116 | mapshot2(m, url = html_fl) 117 | browseURL(html_fl) 118 | 119 | ## create standalone .png; temporary .html is removed automatically unless 120 | ## 'remove_url = FALSE' is specified 121 | mapshot2(m, file = png_fl) 122 | browseURL(png_fl) 123 | mapshot2(m, file = png_fl, 124 | remove_controls = c("homeButton", "layersControl")) 125 | browseURL(png_fl) 126 | 127 | ## create .html and .png 128 | mapshot2(m, url = html_fl, file = png_fl) 129 | browseURL(png_fl) 130 | browseURL(html_fl) 131 | } 132 | 133 | } 134 | \seealso{ 135 | \code{\link[webshot]{webshot}}, \code{\link[htmlwidgets]{saveWidget}}. 136 | 137 | \code{\link[webshot2]{webshot}}. 138 | } 139 | -------------------------------------------------------------------------------- /man/mapview-class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/AAAmapviewClasses.R 3 | \docType{class} 4 | \name{mapview-class} 5 | \alias{mapview-class} 6 | \title{Class mapview} 7 | \description{ 8 | Class mapview 9 | } 10 | \section{Slots}{ 11 | 12 | \describe{ 13 | \item{\code{object}}{the spatial object} 14 | 15 | \item{\code{map}}{the leaflet map object} 16 | }} 17 | 18 | -------------------------------------------------------------------------------- /man/mapview-defunct.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapview-defunct.R 3 | \name{mapview-defunct} 4 | \alias{mapview-defunct} 5 | \title{Defunct functions in mapview} 6 | \description{ 7 | These functions have been removed from package \code{mapview}. 8 | See below for information on which package they have been moved to. 9 | } 10 | \details{ 11 | \itemize{ 12 | \item \code{cubeview}: This function is defunct, and has been 13 | migrated to package 'cubeview'. 14 | \item \code{cubeView}: This function is defunct, and has been 15 | migrated to package 'cubeview'. 16 | \item \code{cubeViewOutput}: This function is defunct, and has been 17 | migrated to package 'cubeview'. 18 | \item \code{renderCubeView}: This function is defunct, and has been 19 | migrated to package 'cubeview'. 20 | \item \code{slideview}: This function is defunct, and has been 21 | migrated to package 'slideview'. 22 | \item \code{slideView}: This function is defunct, and has been 23 | migrated to package 'slideview'. 24 | \item \code{slideViewOutput}: This function is defunct, and has been 25 | migrated to package 'slideview'. 26 | \item \code{renderslideView}: This function is defunct, and has been 27 | migrated to package 'slideview'. 28 | \item \code{latticeView}: This function is defunct, and has been 29 | migrated to package 'leafsync'. 30 | \item \code{sync}: This function is defunct, and has been 31 | migrated to package 'leafsync'. 32 | \item \code{plainview}: This function is defunct, and has been 33 | migrated to package 'plainview'. 34 | \item \code{plainView}: This function is defunct, and has been 35 | migrated to package 'plainview'. 36 | \item \code{popupTable}: This function is defunct, and has been 37 | migrated to package 'leafpop'. 38 | \item \code{popupImage}: This function is defunct, and has been 39 | migrated to package 'leafpop'. 40 | \item \code{popupGraph}: This function is defunct, and has been 41 | migrated to package 'leafpop'. 42 | \item \code{addFeatures}: This function is defunct, and has been 43 | migrated to package 'leafem'. 44 | \item \code{garnishMap}: This function is defunct, and has been 45 | migrated to package 'leafem'. 46 | \item \code{addHomeButton}: This function is defunct, and has been 47 | migrated to package 'leafem'. 48 | \item \code{removeHomeButton}: This function is defunct, and has been 49 | migrated to package 'leafem'. 50 | \item \code{addImageQuery}: This function is defunct, and has been 51 | migrated to package 'leafem'. 52 | \item \code{addLogo}: This function is defunct, and has been 53 | migrated to package 'leafem'. 54 | \item \code{addMouseCoordinates}: This function is defunct, and has been 55 | migrated to package 'leafem'. 56 | \item \code{removeMouseCoordinates}: This function is defunct, and has been 57 | migrated to package 'leafem'. 58 | \item \code{addStaticLabels}: This function is defunct, and has been 59 | migrated to package 'leafem'. 60 | \item \code{addExtent}: This function is defunct, and has been 61 | migrated to package 'leafem'. 62 | \item \code{addStarsImage}: This function is defunct, and has been 63 | migrated to package 'leafem'. 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /man/mapview-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapview-package.R 3 | \docType{package} 4 | \name{mapview-package} 5 | \alias{mapview-package} 6 | \title{mapview: Interactive Viewing of Spatial Data in R} 7 | \description{ 8 | Quickly and conveniently create interactive visualisations of spatial data with or without background maps. Attributes of displayed features are fully queryable via pop-up windows. Additional functionality includes methods to visualise true- and false-color raster images and bounding boxes. 9 | } 10 | \details{ 11 | The package provides functionality to view spatial objects interactively. 12 | The intention is to provide interactivity for easy and quick visualization 13 | during spatial data analysis. It is not intended for fine-tuned presentation 14 | quality map production. 15 | } 16 | \seealso{ 17 | Useful links: 18 | \itemize{ 19 | \item \url{https://github.com/r-spatial/mapview} 20 | \item \url{https://r-spatial.github.io/mapview/} 21 | \item Report bugs at \url{https://github.com/r-spatial/mapview/issues} 22 | } 23 | 24 | } 25 | \author{ 26 | \strong{Maintainer}: Tim Appelhans \email{tim.appelhans@gmail.com} 27 | 28 | Authors: 29 | \itemize{ 30 | \item Florian Detsch \email{fdetsch@web.de} 31 | \item Christoph Reudenbach \email{reudenbach@geo.uni-marburg.de} 32 | \item Stefan Woellauer \email{stephan.woellauer@geo.uni-marburg.de} 33 | } 34 | 35 | Other contributors: 36 | \itemize{ 37 | \item Spaska Forteva \email{spaska.forteva@geo.uni-marburg.de} [contributor] 38 | \item Thomas Nauss \email{nauss@staff.uni-marburg.de} [contributor] 39 | \item Edzer Pebesma [contributor] 40 | \item Kenton Russell [contributor] 41 | \item Michael Sumner [contributor] 42 | \item Jochen Darley \email{Debugger@jedimasters.de} [contributor] 43 | \item Pierre Roudier [contributor] 44 | \item Patrick Schratz [contributor] 45 | \item Environmental Informatics Marburg [contributor] 46 | \item Lorenzo Busetto [contributor] 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /man/mapviewColors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/color.R 3 | \name{mapviewColors} 4 | \alias{mapviewColors} 5 | \alias{mapviewPalette} 6 | \alias{mapViewPalette} 7 | \title{mapview version of leaflet::color* functions} 8 | \usage{ 9 | mapviewColors( 10 | x, 11 | zcol = NULL, 12 | colors = mapviewGetOption("vector.palette"), 13 | at = NULL, 14 | na.color = mapviewGetOption("na.color"), 15 | ... 16 | ) 17 | 18 | mapviewPalette(name = "mapviewVectorColors") 19 | 20 | mapViewPalette(name) 21 | } 22 | \arguments{ 23 | \item{x}{Spatial* or Raster* object} 24 | 25 | \item{zcol}{the column to be colored} 26 | 27 | \item{colors}{color vector to be used for coloring the levels 28 | specified in at} 29 | 30 | \item{at}{numeric vector giving the breakpoints for the colors} 31 | 32 | \item{na.color}{the color for NA values.} 33 | 34 | \item{...}{additional arguments passed on to \code{\link[lattice]{level.colors}}} 35 | 36 | \item{name}{Name of the color palette to be used. One of 37 | "mapviewVectorColors" (default), "mapviewRasterColors", 38 | "mapviewSpectralColors" or "mapviewTopoColors".} 39 | } 40 | \description{ 41 | mapview version of leaflet::color* functions 42 | 43 | Color palettes for mapview 44 | } 45 | \seealso{ 46 | \code{\link[lattice]{level.colors}} 47 | 48 | \code{\link{colorRampPalette}} 49 | } 50 | \author{ 51 | Tim Appelhans 52 | } 53 | -------------------------------------------------------------------------------- /man/mapviewOutput.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/shiny-mapview.R 3 | \name{mapviewOutput} 4 | \alias{mapviewOutput} 5 | \title{Create a mapview UI element for use with shiny} 6 | \usage{ 7 | mapviewOutput(outputId, width = "100\%", height = 400) 8 | } 9 | \arguments{ 10 | \item{outputId}{Output variable to read from} 11 | 12 | \item{width, height}{the width and height of the map 13 | (see \code{\link[htmlwidgets]{shinyWidgetOutput}})} 14 | } 15 | \description{ 16 | Create a mapview UI element for use with shiny 17 | } 18 | -------------------------------------------------------------------------------- /man/mapviewWatcher.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/watch.R 3 | \name{mapviewWatcher} 4 | \alias{mapviewWatcher} 5 | \alias{startWatching} 6 | \alias{stopWatching} 7 | \title{Start and/or stop automagic mapviewing of spatial objects in your workspace.} 8 | \usage{ 9 | mapviewWatcher(env = .GlobalEnv, ...) 10 | 11 | startWatching(env = .GlobalEnv, ...) 12 | 13 | stopWatching(env = .GlobalEnv, ...) 14 | } 15 | \arguments{ 16 | \item{env}{the environment that is being watched (default is \code{.GlobalEnv}).} 17 | 18 | \item{...}{currently not used.} 19 | } 20 | \description{ 21 | Use these functions to enable automatic viewing of all spatial objects 22 | currently available in \code{env}. \code{mapviewWatcher} uses 23 | \link[later]{later} to set up a watcher function that continuously monitors 24 | \code{env} for spatial objects and refreshes the viewer/browser in case 25 | the list of spatial objects changes. 26 | \cr 27 | \cr 28 | \code{startWatching} and \code{stopWatching} are convenience functions to 29 | start and stop watching, respectively. 30 | } 31 | \details{ 32 | \code{mapviewWatcher} uses \code{\link{identical}} and hence 33 | will redraw even if e.g. the attributes of a spatial object are changed only 34 | slightly. By default \code{mapviewWatcher} watches the \code{.GlobalEnv} but 35 | this can be changed to another environment. Whether watching is turned on is 36 | controlled by \code{mapviewGetOption("watch")}. In order to enable watching it 37 | needs to be set to \code{mapviewOptions(watch = TRUE)} 38 | (default is \code{FALSE}) and the watcher needs to be initiated by calling 39 | \code{mapviewWatcher()} once. To switch watching off it is sufficient to set 40 | \code{mapviewOptions(watch = FALSE)}. 41 | } 42 | \section{Functions}{ 43 | \itemize{ 44 | \item \code{startWatching()}: start watching 45 | 46 | \item \code{stopWatching()}: stop watching 47 | 48 | }} 49 | \examples{ 50 | if (interactive()) { 51 | library(mapview) 52 | 53 | ## start the watcher 54 | mapview::startWatching() 55 | 56 | ## load some data and watch the automatic visualisation 57 | fran = mapview::franconia 58 | brew = mapview::breweries 59 | 60 | ## stop the watcher 61 | mapview::stopWatching() 62 | 63 | ## loading or removing things now will not trigger a view update 64 | rm(brew) 65 | trls = mapview::trails 66 | 67 | ## re-starting the viewer will re-draw whatever is currently available 68 | mapview::startWatching() 69 | 70 | ## watcher can also be stopped via mapviewOptions 71 | mapviewOptions(watch = FALSE) 72 | 73 | rm(trls) 74 | 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /man/npts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sf.R 3 | \name{npts} 4 | \alias{npts} 5 | \title{count the number of points/vertices/nodes of sf objects} 6 | \usage{ 7 | npts(x, by_feature = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{an sf/sfc object} 11 | 12 | \item{by_feature}{count total number of vertices (FALSE) of for each feature (TRUE).} 13 | } 14 | \description{ 15 | count the number of points/vertices/nodes of sf objects 16 | } 17 | \note{ 18 | currently only works for *POINTS, *LINES and *POLYGONS (not GEOMETRYCOLLECTION). 19 | } 20 | \examples{ 21 | npts(franconia) 22 | npts(franconia, by_feature = TRUE) 23 | npts(sf::st_geometry(franconia[1, ])) # first polygon 24 | 25 | npts(breweries) # is the same as 26 | nrow(breweries) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/ops.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ops.R 3 | \docType{methods} 4 | \name{ops} 5 | \alias{ops} 6 | \alias{+,mapview,mapview-method} 7 | \alias{+,mapview,ANY-method} 8 | \alias{+,mapview,NULL-method} 9 | \alias{+,mapview,character-method} 10 | \alias{|,mapview,mapview-method} 11 | \alias{|,mapview,NULL-method} 12 | \alias{|,NULL,mapview-method} 13 | \title{mapview + mapview adds data from the second map to the first} 14 | \usage{ 15 | \S4method{+}{mapview,mapview}(e1, e2) 16 | 17 | \S4method{+}{mapview,ANY}(e1, e2) 18 | 19 | \S4method{+}{mapview,NULL}(e1, e2) 20 | 21 | \S4method{+}{mapview,character}(e1, e2) 22 | 23 | \S4method{|}{mapview,NULL}(e1, e2) 24 | 25 | \S4method{|}{NULL,mapview}(e1, e2) 26 | } 27 | \arguments{ 28 | \item{e1}{a leaflet or mapview map, or NULL.} 29 | 30 | \item{e2}{a leaflet or mapview map, or NULL.} 31 | } 32 | \description{ 33 | mapview + mapview adds data from the second map to the first 34 | 35 | mapview + data adds spatial data (raster*, sf*, sp*) to a mapview map 36 | 37 | mapview + NULL returns the LHS map 38 | 39 | \link{...} 40 | 41 | mapview | mapview provides a slider in the middle to compare two maps. 42 | 43 | mapview | NULL returns the LHS map 44 | 45 | NULL | mapview returns the RHS map 46 | } 47 | \examples{ 48 | m1 <- mapView(franconia, col.regions = "red") 49 | m2 <- mapView(breweries) 50 | 51 | ### add two mapview objects 52 | m1 + m2 53 | 54 | ### add layers to a mapview object 55 | if (interactive()) { 56 | library(plainview) 57 | m1 + breweries + plainview::poppendorf[[4]] 58 | } 59 | 60 | m1 <- mapView(franconia, col.regions = "red") 61 | m2 <- mapView(breweries) 62 | 63 | ### add two mapview objects 64 | m1 | m2 65 | 66 | } 67 | -------------------------------------------------------------------------------- /man/print-mapview-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.R 3 | \name{print,mapview-method} 4 | \alias{print,mapview-method} 5 | \title{Method for printing mapview objects} 6 | \usage{ 7 | \S4method{print}{mapview}(x) 8 | } 9 | \arguments{ 10 | \item{x}{a mapview object} 11 | } 12 | \description{ 13 | Method for printing mapview objects 14 | } 15 | -------------------------------------------------------------------------------- /man/removeMapJunk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapshot.R 3 | \name{removeMapJunk} 4 | \alias{removeMapJunk} 5 | \title{Delete elements from a map.} 6 | \usage{ 7 | removeMapJunk(map, junk = NULL) 8 | } 9 | \arguments{ 10 | \item{map}{the map from which to remove elements.} 11 | 12 | \item{junk}{a charcter vector of elements to remove. If NULL (the default), 13 | nothing is removed and the map is returned as is. See Details for a list 14 | of currently supported elements.} 15 | } 16 | \description{ 17 | Delete elements from a map. 18 | } 19 | \details{ 20 | Currently supports removal of 21 | 22 | \itemize{ 23 | \item "zoomControl" 24 | \item "layersControl" 25 | \item "homeButton" 26 | \item "scaleBar" 27 | \item "drawToolbar" 28 | \item "easyButton" 29 | } 30 | 31 | This is mainly useful when taking a static screenshot of a map. 32 | } 33 | \examples{ 34 | if (interactive()) { 35 | library(mapview) 36 | 37 | map = mapview(franconia) 38 | 39 | removeMapJunk(map, "zoomControl") 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /man/renderMapview.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/shiny-mapview.R 3 | \name{renderMapview} 4 | \alias{renderMapview} 5 | \title{Render a mapview widget in shiny} 6 | \usage{ 7 | renderMapview(expr, env = parent.frame(), quoted = FALSE) 8 | } 9 | \arguments{ 10 | \item{expr}{An expression that generates an HTML widget} 11 | 12 | \item{env}{The environment in which to evaluate expr} 13 | 14 | \item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? 15 | This is useful if you want to save an expression in a variable} 16 | } 17 | \description{ 18 | Render a mapview widget in shiny 19 | } 20 | -------------------------------------------------------------------------------- /man/show-mapview-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.R 3 | \name{show,mapview-method} 4 | \alias{show,mapview-method} 5 | \title{Method for printing mapview objects (show)} 6 | \usage{ 7 | \S4method{show}{mapview}(object) 8 | } 9 | \arguments{ 10 | \item{object}{a mapview object} 11 | } 12 | \description{ 13 | Method for printing mapview objects (show) 14 | } 15 | -------------------------------------------------------------------------------- /man/trails.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mapview-package.R 3 | \docType{data} 4 | \name{trails} 5 | \alias{trails} 6 | \title{Selected hiking trails in Franconia} 7 | \format{ 8 | \code{sf feature collection MULTILINESTRING} 9 | } 10 | \source{ 11 | Datenquelle: Bayerische Vermessungsverwaltung - \code{www.geodaten.bayern.de} 12 | \url{https://www.ldbv.bayern.de/produkte/weitere/opendata.html} 13 | } 14 | \usage{ 15 | trails 16 | } 17 | \description{ 18 | Selected hiking trails in Franconia 19 | } 20 | \details{ 21 | These hiking trails were downloaded on 06/04/2017 from 22 | \url{https://geoportal.bayern.de/bayernatlas} 23 | These data are published by the owner under Creative Commons Namensnennung 3.0 Deutschland, 24 | see \url{https://creativecommons.org/licenses/by/3.0/de/} for details. 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/viewExtent.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/extent.R 3 | \name{viewExtent} 4 | \alias{viewExtent} 5 | \title{View extent/bbox of spatial objects interactively} 6 | \usage{ 7 | viewExtent( 8 | x, 9 | map = NULL, 10 | popup = NULL, 11 | layer.name = NULL, 12 | alpha.regions = 0.2, 13 | label = NULL, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{either a Raster*, sf* or Spatial* object} 19 | 20 | \item{map}{a leaflet or mapview map the extent should be added to. If NULL 21 | standard background layers are created.} 22 | 23 | \item{popup}{a \code{list} of HTML strings with the popup contents, usually 24 | created from \code{\link[leafpop]{popupTable}}. See \code{\link[leaflet]{addControl}} for 25 | details.} 26 | 27 | \item{layer.name}{the name of the layer to be shown on the map.} 28 | 29 | \item{alpha.regions}{opacity of the fills or the raster layer(s).} 30 | 31 | \item{label}{a character vector of labels to be shown on mouseover. See 32 | \code{\link[leaflet]{addControl}} for details.} 33 | 34 | \item{...}{ 35 | Arguments passed on to \code{\link[leaflet:map-layers]{leaflet::addRectangles}} 36 | \describe{ 37 | \item{\code{layerId}}{the layer id} 38 | \item{\code{data}}{the data object from which the argument values are derived; by 39 | default, it is the \code{data} object provided to \code{leaflet()} 40 | initially, but can be overridden} 41 | \item{\code{group}}{the name of the group the newly created layers should belong to 42 | (for \code{\link[leaflet]{clearGroup}} and \code{\link[leaflet]{addLayersControl}} purposes). 43 | Human-friendly group names are permitted--they need not be short, 44 | identifier-style names. Any number of layers and even different types of 45 | layers (e.g. markers and polygons) can share the same group name.} 46 | \item{\code{options}}{a list of extra options for tile layers, popups, paths 47 | (circles, rectangles, polygons, ...), or other map elements} 48 | \item{\code{popupOptions}}{A Vector of \code{\link[leaflet]{popupOptions}} to provide popups} 49 | \item{\code{labelOptions}}{A Vector of \code{\link[leaflet]{labelOptions}} to provide label 50 | options for each label. Default \code{NULL}} 51 | \item{\code{stroke}}{whether to draw stroke along the path (e.g. the borders of 52 | polygons or circles)} 53 | \item{\code{color}}{stroke color} 54 | \item{\code{weight}}{stroke width in pixels} 55 | \item{\code{opacity}}{stroke opacity (or layer opacity for tile layers)} 56 | \item{\code{fill}}{whether to fill the path with color (e.g. filling on polygons or 57 | circles)} 58 | \item{\code{fillColor}}{fill color} 59 | \item{\code{fillOpacity}}{fill opacity} 60 | \item{\code{dashArray}}{a string that defines the stroke 61 | \href{https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray}{dash 62 | pattern}} 63 | \item{\code{highlightOptions}}{Options for highlighting the shape on mouse over.} 64 | \item{\code{smoothFactor}}{how much to simplify the polyline on each zoom level 65 | (more means better performance and less accurate representation)} 66 | \item{\code{noClip}}{whether to disable polyline clipping} 67 | \item{\code{lng1,lat1,lng2,lat2}}{latitudes and longitudes of the south-west and 68 | north-east corners of rectangles} 69 | }} 70 | } 71 | \description{ 72 | This function produces an interactive view of the extent/bbox 73 | of the supplied spatial object 74 | } 75 | \examples{ 76 | library(leaflet) 77 | 78 | viewExtent(breweries) 79 | viewExtent(franconia) + breweries 80 | mapview(franconia) \%>\% leafem::addExtent(franconia, fillColor = "yellow") 81 | leaflet() \%>\% addProviderTiles("OpenStreetMap") \%>\% leafem::addExtent(breweries) 82 | leaflet() \%>\% addProviderTiles("OpenStreetMap") \%>\% leafem::addExtent(breweries) 83 | 84 | } 85 | \author{ 86 | Tim Appelhans 87 | } 88 | -------------------------------------------------------------------------------- /man/viewRGB.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/viewRGB.R 3 | \docType{methods} 4 | \name{viewRGB} 5 | \alias{viewRGB} 6 | \alias{viewRGB,RasterStackBrick-method} 7 | \title{Red-Green-Blue map view of a multi-layered Raster object} 8 | \usage{ 9 | viewRGB( 10 | x, 11 | r = 3, 12 | g = 2, 13 | b = 1, 14 | quantiles = c(0.02, 0.98), 15 | map = NULL, 16 | maxpixels = mapviewGetOption("mapview.maxpixels"), 17 | map.types = mapviewGetOption("basemaps"), 18 | na.color = mapviewGetOption("na.color"), 19 | layer.name = NULL, 20 | method = c("bilinear", "ngb"), 21 | ... 22 | ) 23 | } 24 | \arguments{ 25 | \item{x}{a RasterBrick, RasterStack} 26 | 27 | \item{r}{integer. Index of the Red channel/band, between 1 and nlayers(x)} 28 | 29 | \item{g}{integer. Index of the Green channel/band, between 1 and nlayers(x)} 30 | 31 | \item{b}{integer. Index of the Blue channel/band, between 1 and nlayers(x)} 32 | 33 | \item{quantiles}{the upper and lower quantiles used for color stretching. If set to NULL, no stretching is applied.} 34 | 35 | \item{map}{the map to which the layer should be added} 36 | 37 | \item{maxpixels}{integer > 0. Maximum number of cells to use for the plot. 38 | If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting.} 39 | 40 | \item{map.types}{character spcifications for the base maps. 41 | see \url{https://leaflet-extras.github.io/leaflet-providers/preview/} 42 | for available options.} 43 | 44 | \item{na.color}{the color to be used for NA pixels} 45 | 46 | \item{layer.name}{the name of the layer to be shown on the map} 47 | 48 | \item{method}{Method used to compute 49 | values for the resampled layer that is passed on to leaflet. mapview does 50 | projection on-the-fly to ensure correct display and therefore needs to know 51 | how to do this projection. The default is 'bilinear' (bilinear interpolation), 52 | which is appropriate for continuous variables. The other option, 'ngb' 53 | (nearest neighbor), is useful for categorical variables.} 54 | 55 | \item{...}{additional arguments passed on to \code{\link{mapView}}} 56 | } 57 | \description{ 58 | Make a Red-Green-Blue plot based on three layers (in a RasterBrick, RasterStack). 59 | Three layers (sometimes referred to as "bands" because they may represent 60 | different bandwidths in the electromagnetic spectrum) are combined such 61 | that they represent the red, green and blue channel. This function can 62 | be used to make 'true (or false) color images' from Landsat and other 63 | multi-band satellite images. Note, this text is plagiarized, i.e. copied 64 | from \code{\link[raster:plotRGB]{raster::plotRGB()}}. 65 | } 66 | \examples{ 67 | if (interactive()) { 68 | library(raster) 69 | library(plainview) 70 | 71 | viewRGB(plainview::poppendorf, 4, 3, 2) # true-color 72 | viewRGB(plainview::poppendorf, 5, 4, 3) # false-color 73 | } 74 | 75 | } 76 | \author{ 77 | Tim Appelhans 78 | } 79 | -------------------------------------------------------------------------------- /mapview.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | ProjectId: c41c2b3f-9fb4-47ce-be17-708e192e3b02 3 | 4 | RestoreWorkspace: No 5 | SaveWorkspace: No 6 | AlwaysSaveHistory: Default 7 | 8 | EnableCodeIndexing: Yes 9 | UseSpacesForTab: Yes 10 | NumSpacesForTab: 2 11 | Encoding: UTF-8 12 | 13 | RnwWeave: knitr 14 | LaTeX: pdfLaTeX 15 | 16 | AutoAppendNewline: Yes 17 | StripTrailingWhitespace: Yes 18 | 19 | BuildType: Package 20 | PackageInstallArgs: --no-multiarch --with-keep.source --resave-data 21 | PackageBuildArgs: --resave-data 22 | PackageCheckArgs: --as-cran 23 | PackageRoxygenize: rd,collate,namespace 24 | -------------------------------------------------------------------------------- /tests/tinytest.R: -------------------------------------------------------------------------------- 1 | if (requireNamespace("tinytest", quietly=TRUE)) { 2 | tinytest::test_package("mapview") 3 | } 4 | -------------------------------------------------------------------------------- /vignettes/articles/mapview_01-basics.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "1. mapview basics" 3 | output: 4 | rmarkdown::html_document: 5 | toc: yes 6 | toc_float: yes 7 | theme: united 8 | --- 9 | 10 | ```{r setup, echo=FALSE} 11 | knitr::opts_chunk$set(fig.width = 8.83, message = FALSE) 12 | ``` 13 | 14 | **mapview** is intended to provide a quick and easy way to visualize/plot spatial data in an interactive manner. As such, a one-liner is enough to produce an interactive map view of the data. Methods are defined for all objects from packages **sf**, **sp**, **raster** and **satellite**. 15 | 16 | # Vector data 17 | 18 | **mapview** includes 3 vector type data sets: 19 | 20 | * `breweries` - a selection of (micro-) breweries in Franconia, Bavaria. 21 | * `trails` - slected hiking trails in Franconia (not used in this vignette). 22 | * `franconia` - administrative regions of Franconia at the district level. 23 | 24 | 25 | For vector data a call to `mapview` without any further arguments will produce a default map view including: 26 | 27 | * a layer control to switch between 5 different background maps 28 | * a scale bar 29 | * information on mouse cursor position and zoom level of the current view 30 | * a zoom-to-layer button to easily navigate to the displayed layer 31 | * popups listing all attribute entries of the respective features (when clicked) 32 | * labels of the feature IDs (when hovered over) 33 | * zoom control buttons provided by the underlying **leaflet** map 34 | * attribution information of the active map layer in the bottom right corener of the map 35 | 36 | Here's an example for each vector type: 37 | 38 | ```{r points} 39 | library(mapview) 40 | mapview(breweries) 41 | ``` 42 | 43 | ------ 44 | 45 | ```{r polygons} 46 | mapview(franconia) 47 | ``` 48 | 49 | ------ 50 | 51 | ## Controlling attribute columns 52 | 53 | If we only want to plot certain columns of the attribute table we can use argument `zcol`. Each column will be rendered as a separate layer. These layers will be colored according to the selected attributes. 54 | 55 | ```{r points zcol} 56 | mapview(breweries, zcol = c("brewery", "village", "founded")) 57 | ``` 58 | 59 | ------ 60 | 61 | ## Including legends 62 | 63 | We can also include legends for the layers. Be careful, though, as it is currently not possible to link legends to layers so we end up with too many legends to fit the viewer window if we want to visualize many layers. This is also the reason why legends are not shown by default. 64 | 65 | ```{r points legend} 66 | mapview(breweries, zcol = "founded", legend = TRUE) 67 | ``` 68 | 69 | ------ 70 | 71 | ## Automatic background map detection 72 | 73 | Based on the mean luminence of the layer(s) to be rendered, **mapview** will automatically decide which default map to use. For layers with very light colors of `CartoDB.Darkmatter` is used. 74 | 75 | ```{r luminence low} 76 | mapview(breweries) 77 | ``` 78 | 79 |
80 | 81 | Here we also adjust line color and width (using `lwd`) 82 | 83 | ```{r luminence high} 84 | mapview(franconia, color = "cyan", col.regions = "white", lwd = 3) 85 | ``` 86 | 87 | ------ 88 | 89 | # Raster data 90 | 91 | Here's an example for raster data: 92 | 93 | ## Raster Layer 94 | 95 | ```{r layer, message = FALSE, warning=FALSE} 96 | library(plainview) 97 | 98 | mapview(poppendorf[[5]], legend = TRUE) 99 | ``` 100 | 101 | ------ 102 | 103 | ## RasterStack/Brick 104 | 105 | `mapview()` will produce one map view layer for each layer in the stack/brick. Use the layers control to switch between the layers. By default all layers are shown (see chapter advanced for an example on how to hide all but one layer). 106 | 107 | The `kiliNDVI` data can be loaded like this: 108 | 109 | ```{r kili, message = FALSE, warning=FALSE} 110 | kili_data <- system.file("extdata", "kiliNDVI.tif", package = "mapview") 111 | kiliNDVI <- raster::stack(kili_data) 112 | 113 | ## view the first 3 layers 114 | mapview(kiliNDVI[[1:3]]) 115 | ``` 116 | -------------------------------------------------------------------------------- /vignettes/articles/mapview_03-options.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "3. mapview options" 3 | output: 4 | rmarkdown::html_document: 5 | toc: true 6 | theme: united 7 | vignette: > 8 | %\VignetteIndexEntry{3. mapview options} 9 | %\VignetteEngine{knitr::rmarkdown} 10 | %\VignetteEncoding{UTF-8} 11 | --- 12 | 13 | ```{r setup, echo=FALSE} 14 | knitr::opts_chunk$set(fig.width = 8.83) 15 | ``` 16 | 17 | 18 | `mapviewOptions` can be used to set several plotting parameters (arguments) globally, meaning that they will be valid for as long as the session is active. 19 | 20 | A call to `mapviewOptions()` will show all options and their default values in the console 21 | 22 | ```{r options, message = FALSE} 23 | library(mapview) 24 | mapviewOptions() 25 | ``` 26 | 27 | ---- 28 | 29 | In detail, these are: 30 | 31 | * `platform` - the rendering platform: `leaflet` (default), `mapdeck`, or `leafgl` 32 | * `basemaps` - the default `map.types` used by **mapview** 33 | * `raster.size` - the maximum number of bytes to allow for the projected raster image rendering (before base64 encoding) -> default 8MB 34 | * `mapview.maxpixels` - the maximum number of pixels to allow for raster image rendering on the map background -> default 500k 35 | * `plainview.maxpixels` - the maximum number of pixels to allow for plain raster image rendering without the map background -> default 1 Million 36 | * `maxpolygons` - the maximum number of polygons to allow for polygon rendering using standard **leaflet** (package) implementation. If an object has more features than this threshold, special canvas shader rendering is used. Note that this will result in less flexible rendering as many of the standard arguments will not be available (e.g. color mapping). -> default 30k 37 | * `maxpoints` - as for `maxpolygons` but for point features -> default 20k 38 | * `maxlines` - as for `maxpolygons` but for line features -> default 30k 39 | * `raster.palette` - the default palette used for rendering raster images -> default `hcl.colors(n, palette = "Inferno")` 40 | * `vector.palette` - the default palette used for rendering vector features -> default `hcl.colors(n, palette = "viridis")` 41 | * `verbose` - whether to print more verbose information to the console during the rendering -> default `FALSE` 42 | * `na.color` - the color to be used for rendering NA values -> default `#BEBEBE80` 43 | * `legend` - whether to plot a legend -> default `FALSE` 44 | * `legend.pos` - where to position the legend if shown -> default `topright` 45 | * `layers.control.pos` - where to position the layers control on the map -> default `topleft` 46 | * `leafletWidth`, `leafletHeight` - the width and height of the map widget -> default `NULL` which means that the browser will be filled if possible 47 | 48 | ------ 49 | 50 | To get the current value of a certain option use `mapviewGetOption()` 51 | 52 | ```{r options get, message = FALSE} 53 | mapviewGetOption("basemaps") 54 | ``` 55 | 56 | To set certain options use `mapviewOptions()` 57 | 58 | ```{r options set, message = FALSE} 59 | 60 | mapviewOptions(basemaps = c("Esri.WorldShadedRelief", "OpenStreetMap.DE"), 61 | raster.palette = grey.colors, 62 | vector.palette = colorRampPalette(c("snow", "cornflowerblue", "grey10")), 63 | na.color = "magenta", 64 | layers.control.pos = "topright") 65 | ``` 66 | 67 | ------ 68 | 69 | ```{r options query} 70 | mapviewOptions() 71 | ``` 72 | 73 | ------ 74 | 75 | ```{r brew back to normal} 76 | mapview(breweries, zcol = "founded", legend = TRUE) 77 | ``` 78 | 79 | ------ 80 | 81 | These options will now be available until the current session is closed. i.e. you quit R 82 | 83 | ```{r options rgb, message = FALSE} 84 | library(plainview) 85 | 86 | mapview(poppendorf[[5]]) 87 | ``` 88 | 89 | ------ 90 | 91 | To change these options permanently, i.e. across sessions, you could place a call to `mapviewOptions` in your `.Rprofile` so that they will be set everytime you start R 92 | 93 | To revert to factory settings use `default = TRUE` 94 | 95 | ```{r options default} 96 | mapviewOptions(default = TRUE) 97 | mapview(franconia) 98 | ``` 99 | 100 | ------ 101 | -------------------------------------------------------------------------------- /vignettes/articles/mapview_04-popups.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "4. mapview popups" 3 | output: 4 | rmarkdown::html_document: 5 | toc: true 6 | theme: united 7 | vignette: > 8 | %\VignetteIndexEntry{4. mapview popups} 9 | %\VignetteEngine{knitr::rmarkdown} 10 | %\VignetteEncoding{UTF-8} 11 | --- 12 | 13 | ```{r setup, echo=FALSE} 14 | knitr::opts_chunk$set(fig.width = 8.83, mesage = FALSE) 15 | ``` 16 | 17 | **mapview** provides a few special popup rendering functions. These can be used to generate: 18 | 19 | * attribute table popups 20 | * graph popups (i.e. plots in popups) 21 | * static (ggplot2, lattice, base) 22 | * interactive (htmlwidgets) 23 | * image popups 24 | 25 | ## Attribute table popups 26 | 27 | `popupTable` is the standard popup function used in mapview. It provides a static table rendering of all attributes of the individual features. 28 | 29 | ```{r popupTable} 30 | library(mapview) 31 | library(leaflet) 32 | library(leafpop) 33 | 34 | mapview(breweries, popup = popupTable(breweries, 35 | zcol = c("brewery", 36 | "village", 37 | "founded"))) 38 | ``` 39 | 40 |
41 | 42 | This can also be used with leaflet maps 43 | 44 | ```{r popupTable leaflet} 45 | leaflet() %>% 46 | addTiles() %>% 47 | addCircleMarkers(data = breweries, 48 | popup = popupTable(breweries)) 49 | ``` 50 | 51 | ------ 52 | 53 | ## Graph popups 54 | 55 | `popupGraph` allows us to include static or interactive (htmlwidgets) plots in popups. In the following example we will show a scatterplot of copper ~ cadmium for each individual feature of the famous meuse data set 56 | 57 | ```{r popupGraph meuse} 58 | library(lattice) 59 | library(sp) 60 | 61 | data(meuse) 62 | coordinates(meuse) <- ~x+y 63 | proj4string(meuse) <- CRS("+init=epsg:28992") 64 | 65 | p <- xyplot(copper ~ cadmium, data = meuse@data, col = "grey", pch = 20, cex = 2) 66 | p <- mget(rep("p", length(meuse))) 67 | 68 | clr <- rep("grey", length(meuse)) 69 | p <- lapply(1:length(p), function(i) { 70 | clr[i] <- "red" 71 | update(p[[i]], col = clr) 72 | }) 73 | 74 | 75 | mapview(meuse, 76 | zcol = "cadmium", 77 | popup = popupGraph(p)) 78 | ``` 79 | 80 | ------ 81 | 82 | ## Interactive popups 83 | 84 | Here's a rather silly example of an interactive popup. I am sure there's many more sensible examples but for the fun of it here's a map in a map popup. 85 | 86 | **A WARNING:** Including interactive popups can quickly lead to very large files that will take a long time to render and also become rather unresponsive. 87 | 88 | ```{r popupGraph interactive} 89 | brew1 <- breweries91[1, ] 90 | 91 | mapview(brew1, 92 | popup = popupGraph(mapview(brew1, 93 | map.types = "Esri.WorldImagery")@map, 94 | type = "html")) 95 | ``` 96 | 97 | ------ 98 | 99 | ## Image popups 100 | 101 | `popupImage` can be used to include images in popups. Both local (file) and remote (web url) images can be used. 102 | 103 | ```{r popup image url} 104 | library(sf) 105 | pnt <- data.frame(x = 174.764474, y = -36.877245) 106 | pnt <- st_as_sf(pnt, coords = c("x", "y"), crs = 4326) 107 | 108 | img <- "https://upload.wikimedia.org/wikipedia/commons/thumb/6/62/Mount_Eden.jpg/640px-Mount_Eden.jpg" 109 | 110 | mapview(pnt, map.types = "Esri.WorldImagery", 111 | popup = popupImage(img, src = "remote")) 112 | ``` 113 | 114 |
115 | 116 | **IMPORTANT NOTICE** for those who want to save maps locally (see chapter `mapview save maps` for details): With the current implementation of `popupImage` (local only) and `popupGraph` we need to save the popup files (graphs, images) in a folder called `popup_graphs` which needs to be located one level above the map widget. Hence, when saving a map locally (with `mapshot` or `saveWisget`) we need to manually copy that folder to on elevel above the destination folder where the map is saved. This should soon be solved but for the time being, in case you don't see any popup images or graphs in your locally saved map, make sure to copy the appropriate folder (which is usually generated in your computers `temp` directory). 117 | 118 | 119 | ------ 120 | 121 | There's also a hidden function that enables us to include all sorts of things via Iframe (which is used internally when rendering **htmlwidgets** graphs). 122 | 123 | But let the Dude show us how this can be used... 124 | 125 | ```{r mapview popupIrame, echo=TRUE, message=FALSE} 126 | mapview(pnt, popup = leafpop:::popupIframe("https://www.youtube.com/embed/iApz08Bh53w?autoplay=1", width = 300, height = 225)) 127 | ``` 128 | 129 | As with **htmlwidgets** in popups, this may quickly produce html files and hence become rather unresponsive. 130 | -------------------------------------------------------------------------------- /vignettes/articles/mapview_05-extras.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "5. extra functionality" 3 | output: 4 | rmarkdown::html_document: 5 | toc: true 6 | toc_float: yes 7 | theme: united 8 | vignette: > 9 | %\VignetteIndexEntry{5. extra functionality} 10 | %\VignetteEngine{knitr::rmarkdown} 11 | %\VignetteEncoding{UTF-8} 12 | --- 13 | 14 | ```{r setup, echo=FALSE, message=FALSE} 15 | knitr::opts_chunk$set(fig.width = 8.83, message = FALSE) 16 | ``` 17 | 18 | **mapview** provides a couple of special convenience functions for all supported spatial data types: 19 | 20 | - `viewExtent` to view extents/bounding boxes of objects 21 | - `sync`ing of multiple maps 22 | 23 | There are also a few *raster-only* specialty functions: 24 | 25 | - `viewRGB` to view RGB (raster) images 26 | 27 | For the following: 28 | 29 | - `plainview` to view raster images without map background 30 | - `slideview` to compare two raster/RGB images 31 | - `cubeview` to view 3D raster cubes 32 | 33 | please refer to the individual help pages (e.g. `?cubeview`) 34 | 35 | # All types 36 | 37 | ## viewExtent 38 | 39 | This can be handy to check whether features overlap or to just check where things are roughly located (e.g. in case we have big data sets, e.g. raster stacks). 40 | 41 | ```{r extent1} 42 | library(mapview) 43 | library(leaflet) 44 | library(plainview) 45 | library(leafsync) 46 | 47 | viewExtent(poppendorf, color = "red") + viewExtent(breweries) 48 | ``` 49 | 50 | ------ 51 | 52 | ## sync & latticeView 53 | 54 | `sync` can be used to produce small multiples that are synchronised. Meaning that if we zoom into one panel, all other panels will also zoom. Additionally, the mouse position is also synced (indicated via a red circle). `sync` provides a very convenient way to compare multiple attributes of the same feature geometry set. 55 | 56 | We can `sync` all panels: 57 | 58 | ```{r sync all} 59 | m1 <- mapview(breweries, zcol = "village", map.types = "Esri.WorldImagery") 60 | m2 <- mapview(breweries, zcol = "brewery", col.regions = heat.colors) 61 | m3 <- mapview(breweries, zcol = "founded", legend = TRUE) 62 | m4 <- leaflet() %>% addTiles() %>% addCircleMarkers(data = breweries) 63 | 64 | sync(m1, m2, m3, m4) 65 | ``` 66 | 67 |
68 | 69 | Any combination of panels: 70 | 71 | ```{r sync selected} 72 | sync(list(m1, m2, m3, m4), 73 | sync = list(c(1, 4), 74 | c(2, 3))) 75 | ``` 76 | 77 |
78 | 79 | We can also control the layout by specifying how many columns we want to have (rows will be automatically set): 80 | 81 | ```{r sync col} 82 | sync(list(m1, m2, m3), ncol = 1) 83 | ``` 84 | 85 |
86 | 87 | `latticeView` will render small multiples without synchronising 88 | 89 | ```{r lattice} 90 | latticeView(m1, m3) 91 | ``` 92 | 93 |
94 | 95 | ------ 96 | 97 | # Raster-only 98 | 99 | ## viewRGB 100 | 101 | `viewRB` can be used to view true- or false-color raster images. It expects a `RasterStack` or `RasterBrick` and the default setting will render layer combination 3-2-1 102 | 103 | ```{r true rgb} 104 | library(plainview) 105 | 106 | viewRGB(poppendorf, r = 4, g = 3, b = 2) 107 | ``` 108 | 109 |
110 | 111 | ```{r false rgb} 112 | viewRGB(poppendorf, 5, 4, 3) 113 | ``` 114 | -------------------------------------------------------------------------------- /vignettes/articles/mapview_06-add.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "6. extra leaflet functionality" 3 | output: 4 | rmarkdown::html_document: 5 | toc: true 6 | toc_float: yes 7 | theme: united 8 | vignette: > 9 | %\VignetteIndexEntry{6. extra leaflet functionality} 10 | %\VignetteEngine{knitr::rmarkdown} 11 | %\VignetteEncoding{UTF-8} 12 | --- 13 | 14 | ```{r setup, echo=FALSE, message=FALSE} 15 | knitr::opts_chunk$set(fig.width = 8.83, message = FALSE, warning = FALSE) 16 | ``` 17 | 18 | Package **leafem** provides a few extra `add*` functions for use with leaflet (and mapview). 19 | 20 | - `addMouseCoordinates` - add a box with mouse position, projection information and zoom level information 21 | - `addLogo` - add images to maps 22 | - `addHomeButton` - add zoom-to button to a map 23 | - `addFeatures` - add features to a map, regardless of features type unresponsive 24 | 25 | Here are some examples: 26 | 27 | ## addMouseCoordinates 28 | 29 | let's us add mouse position information along with detailed information about the layer's projection and zoom level information. By default, only `lon`, `lat` and `zoom` are shown. To also show info on the `epsg code` and the `proj4string` press and hold Ctrl and move the mouse. `addMouseCoordinates` also allows us to copy the info about the current mouse position to the clipboard by holding the Ctrl and left-clicking on the map. 30 | 31 | ```{r addmc default} 32 | library(mapview) 33 | library(leaflet) 34 | library(leafem) 35 | 36 | leaflet() %>% addTiles() %>% leafem::addMouseCoordinates() 37 | ``` 38 | 39 | ------ 40 | 41 | ## addLogo 42 | 43 | can be used to add logos (or any type of image really) to a map 44 | 45 | ```{r logo r} 46 | library(leafem) 47 | img <- "https://www.r-project.org/logo/Rlogo.svg" 48 | leaflet() %>% addTiles() %>% leafem::addLogo(img, url = "https://www.r-project.org/logo/") 49 | ``` 50 | 51 |
52 | 53 | arguments `offset.x`, `offset.y` together with `position` give control about image placement. See `?addLogo` for details 54 | 55 | ```{r logo banana} 56 | m <- mapview(breweries) 57 | library(leafem) 58 | 59 | leafem::addLogo(m, "https://jeroenooms.github.io/images/banana.gif", 60 | position = "bottomleft", 61 | offset.x = 5, 62 | offset.y = 40, 63 | width = 100, 64 | height = 100) 65 | ``` 66 | 67 | ------ 68 | 69 | ## addHomeButton 70 | 71 | can be used to add 'zoom-to-layer' buttons to a map. By default located in the bottom-right corner of the map (can be changed using argument `position`) 72 | 73 | ```{r home} 74 | library(raster) 75 | library(leafem) 76 | 77 | leaflet() %>% 78 | addTiles() %>% 79 | addCircleMarkers(data = breweries91) %>% 80 | leafem::addHomeButton(ext = extent(breweries91), group = "Breweries") 81 | ``` 82 | 83 | ------ 84 | 85 | ## addFeatures 86 | 87 | is a type agnostic `add*` function which will call the appropriate `leaflet::add*` function based on the provided feature type (points, lines, polygons). It is currently defined for handling objects from packages `sf` and `sp`. For `sf` objects, in addition to the standard feature types `POINT`, `MULTIPOINT`, `LINESTRING`, `MULTILINESTRING`, `POLYGON` and `MULTIPOLYGON` it can also handle features of type `sfc_GEOMETRY` which are a collection of mixed types. 88 | 89 | ```{r addpols} 90 | library(leafem) 91 | 92 | leaflet() %>% addTiles() %>% leafem::addFeatures(breweries) 93 | ``` 94 | 95 |
96 | 97 | The standard styling arguments for `leaflet::add*` functions can be used just like in the original `add*` function 98 | 99 | ```{r addpols style} 100 | library(leafem) 101 | 102 | leaflet() %>% 103 | addTiles() %>% 104 | leafem::addFeatures(franconia, weight = 1, fillColor = "grey", color = "black", 105 | opacity = 1, fillOpacity = 0.6) 106 | ``` 107 | 108 |
109 | -------------------------------------------------------------------------------- /vignettes/articles/mapview_07-pipe.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "7. ceci constitue la fin du pipe" 3 | output: 4 | rmarkdown::html_document: 5 | toc: true 6 | toc_float: yes 7 | theme: united 8 | vignette: > 9 | %\VignetteIndexEntry{7. ceci constitue la fin du pipe} 10 | %\VignetteEngine{knitr::rmarkdown} 11 | %\VignetteEncoding{UTF-8} 12 | --- 13 | 14 | ```{r setup, echo=FALSE, message=FALSE} 15 | knitr::opts_chunk$set(fig.width = 8.83, message = FALSE, warning = FALSE) 16 | ``` 17 | 18 | **mapview** can be used in piped expressions using `%>%`, most likely at the very end of it... 19 | 20 | Here are just a few examples of piped workflows: 21 | 22 | ## `plot`ting feature unions 23 | 24 | ```{r pipe1a} 25 | library(mapview) 26 | library(poorman) 27 | library(leaflet) 28 | library(sf) 29 | ``` 30 | 31 | 32 | ```{r pipe1a-3} 33 | franconia %>% 34 | st_union %>% 35 | plot 36 | ``` 37 | 38 |
39 | 40 | ## `mapview`ing feature unions 41 | 42 | ```{r pipe1b} 43 | franconia %>% 44 | st_union %>% 45 | mapview 46 | ``` 47 | 48 |
49 | 50 | ## union by district 51 | 52 | ```{r pipe2, echo=FALSE, eval=FALSE} 53 | franconia %>% 54 | group_by(district) %>% 55 | summarize %>% 56 | mapview(zcol = "district") 57 | ``` 58 | 59 |
60 | 61 | ## districts by area 62 | 63 | ```{r pipe3, echo=FALSE, eval=FALSE} 64 | franconia %>% 65 | group_by(district) %>% 66 | summarize %>% 67 | mutate(area = as.numeric(st_area(.) / 1e6)) %>% 68 | mapview(zcol = "area") 69 | ``` 70 | 71 |
72 | 73 | ## counties by area 74 | 75 | ```{r pipe4} 76 | franconia %>% 77 | mutate(area = as.numeric(st_area(.))) %>% 78 | mapview(zcol = "area", legend = TRUE) 79 | ``` 80 | 81 |
82 | 83 | ## breweries colored by district 84 | 85 | ```{r pipe5} 86 | breweries %>% 87 | st_intersection(franconia) %>% 88 | mapview(zcol = "district") 89 | ``` 90 | 91 |
92 | 93 | ## number of breweries by county 94 | 95 | ```{r pipe6} 96 | franconia %>% 97 | mutate(count = lengths(st_contains(., breweries))) %>% 98 | mapview(zcol = "count") 99 | ``` 100 | 101 |
102 | 103 | ## brewery density by county 104 | 105 | ```{r pipe7} 106 | franconia %>% 107 | mutate(count = lengths(st_contains(., breweries)), 108 | density = count / as.numeric(st_area(.))) %>% 109 | mapview(zcol = "density") 110 | ``` 111 | 112 |
113 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/HomeButton-0.0.1/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Daniel Montague 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/HomeButton-0.0.1/easy-button-src.min.js: -------------------------------------------------------------------------------- 1 | !function(){function a(a,c){this.title=a.title,this.stateName=a.stateName?a.stateName:"unnamed-state",this.icon=L.DomUtil.create("span",""),L.DomUtil.addClass(this.icon,"button-state state-"+this.stateName.replace(/(^\s*|\s*$)/g,"")),this.icon.innerHTML=b(a.icon),this.onClick=L.Util.bind(a.onClick?a.onClick:function(){},c)}function b(a){var b;return a.match(/[&;=<>"']/)?b=a:(a=a.replace(/(^\s*|\s*$)/g,""),b=L.DomUtil.create("span",""),0===a.indexOf("fa-")?L.DomUtil.addClass(b,"fa "+a):0===a.indexOf("glyphicon-")?L.DomUtil.addClass(b,"glyphicon "+a):L.DomUtil.addClass(b,a),b=b.outerHTML),b}L.Control.EasyBar=L.Control.extend({options:{position:"bottomright",id:null,leafletClasses:!0},initialize:function(a,b){b&&L.Util.setOptions(this,b),this._buildContainer(),this._buttons=[];for(var c=0;cpx; 86 | height: <%=height%>px; 87 | } 88 | 89 | .leaflet-popup-content p { 90 | margin: 8px 0; 91 | } 92 | 93 | .leaflet-popup-tip-container { 94 | width: 40px; 95 | height: 20px; 96 | position: absolute; 97 | left: 50%; 98 | margin-left: -20px; 99 | overflow: hidden; 100 | pointer-events: none; 101 | } 102 | 103 | .leaflet-popup-tip { 104 | width: 15px; 105 | height: 15px; 106 | padding: 1px; 107 | 108 | margin: -10px auto 0; 109 | 110 | -webkit-transform: rotate(45deg); 111 | -moz-transform: rotate(45deg); 112 | -ms-transform: rotate(45deg); 113 | -o-transform: rotate(45deg); 114 | transform: rotate(45deg); 115 | } 116 | 117 | /* legacy 118 | .leaflet-popup-tip-container { 119 | margin: 0 -10px; 120 | width: 40px; 121 | height: 20px; 122 | position: relative; 123 | overflow: hidden; 124 | } 125 | 126 | .leaflet-popup-tip { 127 | width: 15px; 128 | height: 15px; 129 | padding: 0px; 130 | margin: -10px 0; 131 | 132 | -webkit-transform: rotate(45deg); 133 | -moz-transform: rotate(45deg); 134 | -ms-transform: rotate(45deg); 135 | -o-transform: rotate(45deg); 136 | transform: rotate(45deg); 137 | } 138 | */ 139 | 140 | .leaflet-popup-content-wrapper, .leaflet-popup-tip { 141 | background: #4c4c4c; 142 | box-shadow: 0 3px 14px rgba(0,0,0,0.4); 143 | } 144 | 145 | .leaflet-container a.leaflet-popup-close-button { 146 | position: absolute; 147 | top: 0; 148 | right: -20px; 149 | padding: 3px 0px 0 0; 150 | text-align: center; 151 | width: 18px; 152 | height: 14px; 153 | font: 16px/14px Tahoma, Verdana, sans-serif; 154 | color: #c3c3c3; 155 | text-decoration: none; 156 | font-weight: bold; 157 | background: transparent; 158 | } 159 | 160 | .leaflet-container a.leaflet-popup-close-button:hover { 161 | color: #999; 162 | } 163 | 164 | .leaflet-popup-scrolled { 165 | overflow: visible; 166 | border-bottom: 1px solid #ddd; 167 | border-top: 1px solid #ddd; 168 | } 169 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/layers-2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/layers.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/marker-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/marker-icon-2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/marker-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/marker-icon.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-1.3.1/images/marker-shadow.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/leaflet.yaml: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - name: jquery 3 | version: 1.12.4 4 | src: "htmlwidgets/lib/jquery" 5 | script: jquery.min.js 6 | - name: leaflet 7 | version: 1.3.1 8 | src: "htmlwidgets/lib/leaflet" 9 | script: leaflet.js 10 | stylesheet: leaflet.css 11 | - name: leafletfix 12 | version: 1.0.0 13 | src: "htmlwidgets/lib/leafletfix" 14 | stylesheet: leafletfix.css 15 | - name: Proj4Leaflet 16 | version: 1.0.1 17 | src: "htmlwidgets/plugins/Proj4Leaflet" 18 | script: 19 | - proj4-compressed.js 20 | - proj4leaflet.js 21 | - name: rstudio_leaflet 22 | version: 1.3.1 # match leaflet version 23 | src: "htmlwidgets/lib/rstudio_leaflet" 24 | stylesheet: rstudio_leaflet.css 25 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/cancel.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/cancel_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/cancel_@2X.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/check.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/check_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/check_@2X.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/focus.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/focus_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/focus_@2X.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/rulers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/rulers.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/rulers_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/rulers_@2X.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/start.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/start_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/start_@2X.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/trash.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/trash_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/images/trash_@2X.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-measure/leaflet-measure.css: -------------------------------------------------------------------------------- 1 | .leaflet-control-measure h3,.leaflet-measure-resultpopup h3{margin:0 0 12px 0;padding-bottom:10px;line-height:1em;font-weight:normal;font-size:1.1em;border-bottom:solid 1px #DDD}.leaflet-control-measure p,.leaflet-measure-resultpopup p{margin:10px 0 0;line-height:1em}.leaflet-control-measure p:first-child,.leaflet-measure-resultpopup p:first-child{margin-top:0}.leaflet-control-measure a,.leaflet-measure-resultpopup a{color:#5E66CC;text-decoration:none}.leaflet-control-measure a:hover,.leaflet-measure-resultpopup a:hover{opacity:0.5;text-decoration:none}.leaflet-control-measure .tasks,.leaflet-measure-resultpopup .tasks{margin:12px 0 0;padding:10px 0 0;border-top:solid 1px #DDD;list-style:none;list-style-image:none}.leaflet-control-measure .tasks li,.leaflet-measure-resultpopup .tasks li{display:inline;margin:0 10px 0 0}.leaflet-control-measure .tasks li:last-child,.leaflet-measure-resultpopup .tasks li:last-child{margin-right:0}.leaflet-control-measure .coorddivider,.leaflet-measure-resultpopup .coorddivider{color:#999}.leaflet-control-measure{background:#fff;border-radius:5px;box-shadow:0 1px 5px rgba(0,0,0,0.4)}.leaflet-control-measure .leaflet-control-measure-toggle,.leaflet-control-measure .leaflet-control-measure-toggle:hover{display:block;width:36px;height:36px;background-position:50% 50%;background-repeat:no-repeat;background-image:url(images/rulers.png);border-radius:5px;text-indent:100%;white-space:nowrap;overflow:hidden}.leaflet-retina .leaflet-control-measure .leaflet-control-measure-toggle,.leaflet-retina .leaflet-control-measure .leaflet-control-measure-toggle:hover{background-image:url(images/rulers_@2X.png);background-size:16px 16px}.leaflet-touch .leaflet-control-measure .leaflet-control-measure-toggle,.leaflet-touch .leaflet-control-measure .leaflet-control-measure-toggle:hover{width:44px;height:44px}.leaflet-control-measure .startprompt h3{margin-bottom:10px}.leaflet-control-measure .startprompt .tasks{margin-top:0;padding-top:0;border-top:0}.leaflet-control-measure .leaflet-control-measure-interaction{padding:10px 12px}.leaflet-control-measure .results .group{margin-top:10px;padding-top:10px;border-top:dotted 1px #eaeaea}.leaflet-control-measure .results .group:first-child{margin-top:0;padding-top:0;border-top:0}.leaflet-control-measure .results .heading{margin-right:5px;color:#999}.leaflet-control-measure a.start{padding-left:18px;background-repeat:no-repeat;background-position:0% 50%;background-image:url(images/start.png)}.leaflet-retina .leaflet-control-measure a.start{background-image:url(images/start_@2X.png);background-size:12px 12px}.leaflet-control-measure a.cancel{padding-left:18px;background-repeat:no-repeat;background-position:0% 50%;background-image:url(images/cancel.png)}.leaflet-retina .leaflet-control-measure a.cancel{background-image:url(images/cancel_@2X.png);background-size:12px 12px}.leaflet-control-measure a.finish{padding-left:18px;background-repeat:no-repeat;background-position:0% 50%;background-image:url(images/check.png)}.leaflet-retina .leaflet-control-measure a.finish{background-image:url(images/check_@2X.png);background-size:12px 12px}.leaflet-measure-resultpopup a.zoomto{padding-left:18px;background-repeat:no-repeat;background-position:0% 50%;background-image:url(images/focus.png)}.leaflet-retina .leaflet-measure-resultpopup a.zoomto{background-image:url(images/focus_@2X.png);background-size:12px 12px}.leaflet-measure-resultpopup a.deletemarkup{padding-left:18px;background-repeat:no-repeat;background-position:0% 50%;background-image:url(images/trash.png)}.leaflet-retina .leaflet-measure-resultpopup a.deletemarkup{background-image:url(images/trash_@2X.png);background-size:11px 12px} 2 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-omnivore/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Mapbox 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the {organization} nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | ----------------------------------------------------------------------------- 30 | 31 | TopoJSON 32 | 33 | Copyright (c) 2012, Michael Bostock 34 | All rights reserved. 35 | 36 | Redistribution and use in source and binary forms, with or without 37 | modification, are permitted provided that the following conditions are met: 38 | 39 | * Redistributions of source code must retain the above copyright notice, this 40 | list of conditions and the following disclaimer. 41 | 42 | * Redistributions in binary form must reproduce the above copyright notice, 43 | this list of conditions and the following disclaimer in the documentation 44 | and/or other materials provided with the distribution. 45 | 46 | * The name Michael Bostock may not be used to endorse or promote products 47 | derived from this software without specific prior written permission. 48 | 49 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 50 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 52 | DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, 53 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 54 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 55 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 56 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 57 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 58 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-omnivore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leaflet-omnivore", 3 | "version": "0.3.4", 4 | "description": "a geospatial format parser for Leaflet", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "zuul --local -- test/test.js", 8 | "test-remote": "zuul -- test/test.js", 9 | "test-headless": "zuul --phantom -- test/test.js", 10 | "prepublish": "browserify -s omnivore index.js > leaflet-omnivore.js && uglifyjs leaflet-omnivore.js -c -m > leaflet-omnivore.min.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git@github.com:mapbox/leaflet-omnivore.git" 15 | }, 16 | "files": [ 17 | "index.js", 18 | "leaflet-omnivore.js", 19 | "leaflet-omnivore.min.js" 20 | ], 21 | "browserify": { 22 | "transform": [ 23 | "brfs" 24 | ] 25 | }, 26 | "keywords": [ 27 | "leaflet", 28 | "formats", 29 | "kml", 30 | "csv", 31 | "gpx", 32 | "geojson", 33 | "kml", 34 | "leaflet", 35 | "maps", 36 | "gpx", 37 | "wkt", 38 | "osm", 39 | "polyline", 40 | "topojson", 41 | "format", 42 | "converter" 43 | ], 44 | "author": "Tom MacWright", 45 | "license": "BSD-3-Clause", 46 | "bugs": { 47 | "url": "https://github.com/mapbox/leaflet-omnivore/issues" 48 | }, 49 | "homepage": "https://github.com/mapbox/leaflet-omnivore", 50 | "dependencies": { 51 | "csv2geojson": "~5.0.0", 52 | "togeojson": "0.13.0", 53 | "corslite": "0.0.7", 54 | "wellknown": "0.4.2", 55 | "brfs": "1.4.3", 56 | "topojson": "1.6.26", 57 | "polyline": "0.2.0" 58 | }, 59 | "devDependencies": { 60 | "browserify": "13.0.1", 61 | "tape": "4.5.1", 62 | "uglify-js": "^2.6.2", 63 | "jshint": "2.9.2", 64 | "mocha": "~2.5.3", 65 | "zuul": "~3.10.1", 66 | "st": "1.1.0", 67 | "mapbox.js": "2.4.0", 68 | "phantomjs-prebuilt": "2.1.7" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-providers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leaflet-providers", 3 | "version": "1.1.17", 4 | "description": "An extension to Leaflet that contains configurations for various free tile providers.", 5 | "main": "leaflet-providers.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/leaflet-extras/leaflet-providers.git" 9 | }, 10 | "scripts": { 11 | "test": "npm run lint && npm run testsuite", 12 | "testsuite": "phantomjs ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js tests/index.html", 13 | "lint": "eslint --config .eslintrc leaflet-providers.js index.html preview/*.js preview/*.html tests/*", 14 | "min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js", 15 | "release": "mversion patch -m" 16 | }, 17 | "license": "BSD-2-Clause", 18 | "bugs": { 19 | "url": "https://github.com/leaflet-extras/leaflet-providers/issues" 20 | }, 21 | "files": [ 22 | "leaflet-providers.js", 23 | "README.md", 24 | "CHANGELOG.md", 25 | "licence.md" 26 | ], 27 | "devDependencies": { 28 | "chai": "^4.1.2", 29 | "eslint": "^3.16.1", 30 | "eslint-plugin-html": "^2.0.1", 31 | "mocha": "^3.2.0", 32 | "mocha-phantomjs-core": "^2.1.1", 33 | "mversion": "^1.10.1", 34 | "phantomjs-prebuilt": "^2.1.16", 35 | "uglify-js": "^2.4.15" 36 | }, 37 | "autoupdate": { 38 | "source": "git", 39 | "target": "git://github.com/leaflet-extras/leaflet-providers.git", 40 | "basePath": "/", 41 | "files": [ 42 | "leaflet-providers.js" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet-providers/rstudio_install.md: -------------------------------------------------------------------------------- 1 | # Location 2 | * from: github.com/schloerke/leaflet-providers@urlProtocol 3 | 4 | * Inspiration taken from https://github.com/leaflet-extras/leaflet-providers/commit/dea786a3219f9cc824b8e96903a17f46ca9a5afc to use the 'old' relative url protocols and to 'upgrade' them at js runtime. 5 | 6 | 7 | 8 | # Notes... 9 | 10 | * Copy/paste provider information into `providers.json` 11 | ```js 12 | var providers = L.TileLayer.Provider.providers; 13 | JSON.stringify(providers, null, " "); 14 | ``` 15 | * `./data-raw/providerNames.R` was re-ran to update to the latest providers 16 | 17 | * Some providers had their protocols turned into '//'. 18 | * This allows browsers to pick the protocol 19 | * To stop files from the protocols staying as files, a ducktape patch was applied to `L.TileLayer.prototype.initialize` and `L.TileLayer.WMS.prototype.initialize` 20 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/layers-2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/layers.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/marker-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/marker-icon-2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/marker-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/marker-icon.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leaflet/images/marker-shadow.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/leafletfix/leafletfix.css: -------------------------------------------------------------------------------- 1 | /* Work around CSS properties introduced on img by bootstrap */ 2 | img.leaflet-tile { 3 | padding: 0; 4 | margin: 0; 5 | border-radius: 0; 6 | border: none; 7 | } 8 | .info { 9 | padding: 6px 8px; 10 | font: 14px/16px Arial, Helvetica, sans-serif; 11 | background: white; 12 | background: rgba(255,255,255,0.8); 13 | box-shadow: 0 0 15px rgba(0,0,0,0.2); 14 | border-radius: 5px; 15 | } 16 | .legend { 17 | line-height: 18px; 18 | color: #555; 19 | } 20 | .legend svg text { 21 | fill: #555; 22 | } 23 | .legend svg line { 24 | stroke: #555; 25 | } 26 | .legend i { 27 | width: 18px; 28 | height: 18px; 29 | margin-right: 4px; 30 | opacity: 0.7; 31 | display: inline-block; 32 | vertical-align: top; 33 | /*For IE 7*/ 34 | zoom: 1; 35 | *display: inline; 36 | } 37 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/rstudio_leaflet/images/1px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/rstudio_leaflet/images/1px.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/lib/rstudio_leaflet/rstudio_leaflet.css: -------------------------------------------------------------------------------- 1 | .leaflet-tooltip.leaflet-tooltip-text-only, 2 | .leaflet-tooltip.leaflet-tooltip-text-only:before, 3 | .leaflet-tooltip.leaflet-tooltip-text-only:after { 4 | background: none; 5 | border: none; 6 | box-shadow: none; 7 | } 8 | 9 | .leaflet-tooltip.leaflet-tooltip-text-only.leaflet-tooltip-left { 10 | margin-left: 5px; 11 | } 12 | 13 | .leaflet-tooltip.leaflet-tooltip-text-only.leaflet-tooltip-right { 14 | margin-left: -5px; 15 | } 16 | 17 | .leaflet-tooltip:after { 18 | border-right: 6px solid transparent; 19 | /* right: -16px; */ 20 | } 21 | 22 | .leaflet-popup-pane .leaflet-popup-tip-container { 23 | /* when the tooltip container is clicked, it is closed */ 24 | pointer-events: all; 25 | /* tooltips should display the "hand" icon, just like .leaflet-interactive*/ 26 | cursor: pointer; 27 | } 28 | 29 | /* have the widget be displayed in the right 'layer' */ 30 | .leaflet-map-pane { 31 | z-index: auto; 32 | } 33 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet-MiniMap/Control.MiniMap.css: -------------------------------------------------------------------------------- 1 | .leaflet-control-minimap { 2 | border:solid rgba(255, 255, 255, 1.0) 4px; 3 | box-shadow: 0 1px 5px rgba(0,0,0,0.65); 4 | border-radius: 3px; 5 | background: #f8f8f9; 6 | transition: all .6s; 7 | } 8 | 9 | .leaflet-control-minimap a { 10 | background-color: rgba(255, 255, 255, 1.0); 11 | background-repeat: no-repeat; 12 | z-index: 99999; 13 | transition: all .6s; 14 | } 15 | 16 | .leaflet-control-minimap a.minimized-bottomright { 17 | -webkit-transform: rotate(180deg); 18 | transform: rotate(180deg); 19 | border-radius: 0px; 20 | } 21 | 22 | .leaflet-control-minimap a.minimized-topleft { 23 | -webkit-transform: rotate(0deg); 24 | transform: rotate(0deg); 25 | border-radius: 0px; 26 | } 27 | 28 | .leaflet-control-minimap a.minimized-bottomleft { 29 | -webkit-transform: rotate(270deg); 30 | transform: rotate(270deg); 31 | border-radius: 0px; 32 | } 33 | 34 | .leaflet-control-minimap a.minimized-topright { 35 | -webkit-transform: rotate(90deg); 36 | transform: rotate(90deg); 37 | border-radius: 0px; 38 | } 39 | 40 | .leaflet-control-minimap-toggle-display{ 41 | background-image: url("images/toggle.svg"); 42 | background-size: cover; 43 | position: absolute; 44 | border-radius: 3px 0px 0px 0px; 45 | } 46 | 47 | .leaflet-oldie .leaflet-control-minimap-toggle-display{ 48 | background-image: url("images/toggle.png"); 49 | } 50 | 51 | .leaflet-control-minimap-toggle-display-bottomright { 52 | bottom: 0; 53 | right: 0; 54 | } 55 | 56 | .leaflet-control-minimap-toggle-display-topleft{ 57 | top: 0; 58 | left: 0; 59 | -webkit-transform: rotate(180deg); 60 | transform: rotate(180deg); 61 | } 62 | 63 | .leaflet-control-minimap-toggle-display-bottomleft{ 64 | bottom: 0; 65 | left: 0; 66 | -webkit-transform: rotate(90deg); 67 | transform: rotate(90deg); 68 | } 69 | 70 | .leaflet-control-minimap-toggle-display-topright{ 71 | top: 0; 72 | right: 0; 73 | -webkit-transform: rotate(270deg); 74 | transform: rotate(270deg); 75 | } 76 | 77 | /* Old IE */ 78 | .leaflet-oldie .leaflet-control-minimap { 79 | border: 1px solid #999; 80 | } 81 | 82 | .leaflet-oldie .leaflet-control-minimap a { 83 | background-color: #fff; 84 | } 85 | 86 | .leaflet-oldie .leaflet-control-minimap a.minimized { 87 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); 88 | } 89 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet-MiniMap/Control.MiniMap.min.css: -------------------------------------------------------------------------------- 1 | .leaflet-control-minimap{border:rgba(255,255,255,1) solid;box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:3px;background:#f8f8f9;transition:all .6s}.leaflet-control-minimap a{background-color:rgba(255,255,255,1);background-repeat:no-repeat;z-index:99999;transition:all .6s}.leaflet-control-minimap a.minimized-bottomright{-webkit-transform:rotate(180deg);transform:rotate(180deg);border-radius:0}.leaflet-control-minimap a.minimized-topleft{-webkit-transform:rotate(0deg);transform:rotate(0deg);border-radius:0}.leaflet-control-minimap a.minimized-bottomleft{-webkit-transform:rotate(270deg);transform:rotate(270deg);border-radius:0}.leaflet-control-minimap a.minimized-topright{-webkit-transform:rotate(90deg);transform:rotate(90deg);border-radius:0}.leaflet-control-minimap-toggle-display{background-image:url(images/toggle.svg);background-size:cover;position:absolute;border-radius:3px 0 0}.leaflet-oldie .leaflet-control-minimap-toggle-display{background-image:url(images/toggle.png)}.leaflet-control-minimap-toggle-display-bottomright{bottom:0;right:0}.leaflet-control-minimap-toggle-display-topleft{top:0;left:0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.leaflet-control-minimap-toggle-display-bottomleft{bottom:0;left:0;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.leaflet-control-minimap-toggle-display-topright{top:0;right:0;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.leaflet-oldie .leaflet-control-minimap{border:1px solid #999}.leaflet-oldie .leaflet-control-minimap a{background-color:#fff}.leaflet-oldie .leaflet-control-minimap a.minimized{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)} -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet-MiniMap/Minimap-binding.js: -------------------------------------------------------------------------------- 1 | LeafletWidget.methods.addMiniMap = 2 | function(tilesURL, tilesProvider, position, 3 | width, height, collapsedWidth, collapsedHeight , zoomLevelOffset, 4 | zoomLevelFixed, centerFixed, zoomAnimation , toggleDisplay, autoToggleDisplay, 5 | minimized, aimingRectOptions, shadowRectOptions, strings, mapOptions) { 6 | 7 | (function() { 8 | if(this.minimap) { 9 | this.minimap.removeFrom( this ); 10 | } 11 | 12 | // determin the tiles for the minimap 13 | // default to OSM tiles 14 | layer = new L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); 15 | if(tilesProvider) { 16 | // use a custom tiles provider if specified. 17 | layer = new L.tileLayer.provider(tilesProvider); 18 | } else if(tilesURL) { 19 | // else use a custom tiles URL if specified. 20 | layer = new L.tileLayer(tilesURL); 21 | } 22 | 23 | this.minimap = new L.Control.MiniMap(layer, { 24 | position: position, 25 | width: width, 26 | height: height, 27 | collapsedWidth: collapsedWidth, 28 | collapsedHeight: collapsedWidth, 29 | zoomLevelOffset: zoomLevelOffset, 30 | zoomLevelFixed: zoomLevelFixed, 31 | centerFixed: centerFixed, 32 | zoomAnimation: zoomAnimation, 33 | toggleDisplay: toggleDisplay, 34 | autoToggleDisplay: autoToggleDisplay, 35 | minimized: minimized, 36 | aimingRectOptions: aimingRectOptions, 37 | shadowRectOptions: shadowRectOptions, 38 | strings: strings, 39 | mapOptions: mapOptions 40 | }); 41 | this.minimap.addTo(this); 42 | }).call(this); 43 | }; 44 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet-MiniMap/images/toggle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet-MiniMap/images/toggle.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet-MiniMap/images/toggle.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.EasyButton/EasyButton-binding.js: -------------------------------------------------------------------------------- 1 | getEasyButton = function(button) { 2 | 3 | var options = {}; 4 | 5 | options.position = button.position; 6 | 7 | // only add ID if provided 8 | if(button.id) { 9 | options.id = button.id; 10 | } 11 | 12 | // if custom states provided use that 13 | // else use provided icon and onClick 14 | if(button.states) { 15 | options.states = button.states; 16 | return L.easyButton(options); 17 | } else { 18 | return L.easyButton(button.icon, button.onClick, 19 | button.title, options ); 20 | } 21 | }; 22 | 23 | LeafletWidget.methods.addEasyButton = function(button) { 24 | getEasyButton(button).addTo(this); 25 | }; 26 | 27 | LeafletWidget.methods.addEasyButtonBar = function(buttons, position, id) { 28 | 29 | var options = {}; 30 | 31 | options.position = position; 32 | 33 | // only add ID if provided 34 | if(id) { 35 | options.id = id; 36 | } 37 | 38 | var easyButtons = []; 39 | for(var i=0; i < buttons.length; i++) { 40 | easyButtons[i] = getEasyButton(buttons[i]); 41 | } 42 | L.easyBar(easyButtons).addTo(this); 43 | 44 | }; 45 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.EasyButton/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Daniel Montague 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.EasyButton/easy-button.css: -------------------------------------------------------------------------------- 1 | .leaflet-bar button, 2 | .leaflet-bar button:hover { 3 | background-color: #fff; 4 | border: none; 5 | border-bottom: 1px solid #ccc; 6 | width: 26px; 7 | height: 26px; 8 | line-height: 26px; 9 | display: block; 10 | text-align: center; 11 | text-decoration: none; 12 | color: black; 13 | } 14 | 15 | .leaflet-bar button { 16 | background-position: 50% 50%; 17 | background-repeat: no-repeat; 18 | overflow: hidden; 19 | display: block; 20 | } 21 | 22 | .leaflet-bar button:hover { 23 | background-color: #f4f4f4; 24 | } 25 | 26 | .leaflet-bar button:first-of-type { 27 | border-top-left-radius: 4px; 28 | border-top-right-radius: 4px; 29 | } 30 | 31 | .leaflet-bar button:last-of-type { 32 | border-bottom-left-radius: 4px; 33 | border-bottom-right-radius: 4px; 34 | border-bottom: none; 35 | } 36 | 37 | .leaflet-bar.disabled, 38 | .leaflet-bar button.disabled { 39 | cursor: default; 40 | pointer-events: none; 41 | opacity: .4; 42 | } 43 | 44 | .easy-button-button .button-state{ 45 | display: block; 46 | width: 100%; 47 | height: 100%; 48 | position: relative; 49 | } 50 | 51 | 52 | .leaflet-touch .leaflet-bar button { 53 | width: 30px; 54 | height: 30px; 55 | line-height: 30px; 56 | } 57 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.Graticule/Graticule-binding.js: -------------------------------------------------------------------------------- 1 | LeafletWidget.methods.addGraticule = function(interval, sphere, style, 2 | layerId, group, options) { 3 | (function() { 4 | this.layerManager.addLayer( 5 | L.graticule($.extend({ 6 | interval: interval, 7 | sphere: sphere, 8 | style: style 9 | }, options || {})), 10 | 'shape', layerId, group); 11 | }).call(this); 12 | }; 13 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.Graticule/L.Graticule.js: -------------------------------------------------------------------------------- 1 | /* 2 | Graticule plugin for Leaflet powered maps. 3 | */ 4 | L.Graticule = L.GeoJSON.extend({ 5 | 6 | options: { 7 | style: { 8 | color: '#333', 9 | weight: 1 10 | }, 11 | interval: 20 12 | }, 13 | 14 | initialize: function (options) { 15 | L.Util.setOptions(this, options); 16 | this._layers = {}; 17 | 18 | if (this.options.sphere) { 19 | this.addData(this._getFrame()); 20 | } else { 21 | this.addData(this._getGraticule()); 22 | } 23 | }, 24 | 25 | _getFrame: function() { 26 | return { "type": "Polygon", 27 | "coordinates": [ 28 | this._getMeridian(-180).concat(this._getMeridian(180).reverse()) 29 | ] 30 | }; 31 | }, 32 | 33 | _getGraticule: function () { 34 | var features = [], interval = this.options.interval; 35 | 36 | // Meridians 37 | for (var lng = 0; lng <= 180; lng = lng + interval) { 38 | features.push(this._getFeature(this._getMeridian(lng), { 39 | "name": (lng) ? lng.toString() + "° E" : "Prime meridian" 40 | })); 41 | if (lng !== 0) { 42 | features.push(this._getFeature(this._getMeridian(-lng), { 43 | "name": lng.toString() + "° W" 44 | })); 45 | } 46 | } 47 | 48 | // Parallels 49 | for (var lat = 0; lat <= 90; lat = lat + interval) { 50 | features.push(this._getFeature(this._getParallel(lat), { 51 | "name": (lat) ? lat.toString() + "° N" : "Equator" 52 | })); 53 | if (lat !== 0) { 54 | features.push(this._getFeature(this._getParallel(-lat), { 55 | "name": lat.toString() + "° S" 56 | })); 57 | } 58 | } 59 | 60 | return { 61 | "type": "FeatureCollection", 62 | "features": features 63 | }; 64 | }, 65 | 66 | _getMeridian: function (lng) { 67 | lng = this._lngFix(lng); 68 | var coords = []; 69 | for (var lat = -90; lat <= 90; lat++) { 70 | coords.push([lng, lat]); 71 | } 72 | return coords; 73 | }, 74 | 75 | _getParallel: function (lat) { 76 | var coords = []; 77 | for (var lng = -180; lng <= 180; lng++) { 78 | coords.push([this._lngFix(lng), lat]); 79 | } 80 | return coords; 81 | }, 82 | 83 | _getFeature: function (coords, prop) { 84 | return { 85 | "type": "Feature", 86 | "geometry": { 87 | "type": "LineString", 88 | "coordinates": coords 89 | }, 90 | "properties": prop 91 | }; 92 | }, 93 | 94 | _lngFix: function (lng) { 95 | if (lng >= 180) return 179.999999; 96 | if (lng <= -180) return -179.999999; 97 | return lng; 98 | } 99 | 100 | }); 101 | 102 | L.graticule = function (options) { 103 | return new L.Graticule(options); 104 | }; 105 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.SimpleGraticule/L.SimpleGraticule.css: -------------------------------------------------------------------------------- 1 | .leaflet-grid-label .gridlabel-vert { 2 | margin-left: 8px; 3 | -webkit-transform: rotate(90deg); 4 | transform: rotate(90deg); 5 | } 6 | 7 | .leaflet-grid-label .gridlabel-vert, 8 | .leaflet-grid-label .gridlabel-horiz { 9 | padding-left:2px; 10 | text-shadow: -2px 0 #FFFFFF, 0 2px #FFFFFF, 2px 0 #FFFFFF, 0 -2px #FFFFFF; 11 | } 12 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.SimpleGraticule/SimpleGraticule-binding.js: -------------------------------------------------------------------------------- 1 | LeafletWidget.methods.addSimpleGraticule = function(interval, showOriginLabel, 2 | redraw, hidden, zoomIntervals, layerId, group) { 3 | (function() { 4 | this.layerManager.addLayer( 5 | L.simpleGraticule({ 6 | interval: interval, 7 | showOriginLabel: showOriginLabel, 8 | redraw: redraw, 9 | hidden: hidden, 10 | zoomIntervals: zoomIntervals 11 | }), 12 | 'shape', layerId, group); 13 | }).call(this); 14 | }; 15 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.Terminator/L.Terminator.js: -------------------------------------------------------------------------------- 1 | /* Terminator.js -- Overlay day/night region on a Leaflet map */ 2 | 3 | Date.prototype.getJulian = function() { 4 | /* Calculate the present UTC Julian Date. Function is valid after 5 | * the beginning of the UNIX epoch 1970-01-01 and ignores leap 6 | * seconds. */ 7 | return (this / 86400000) + 2440587.5; 8 | } 9 | 10 | Date.prototype.getGMST = function() { 11 | /* Calculate Greenwich Mean Sidereal Time according to 12 | http://aa.usno.navy.mil/faq/docs/GAST.php */ 13 | var julianDay = this.getJulian(); 14 | var d = julianDay - 2451545.0; 15 | // Low precision equation is good enough for our purposes. 16 | return (18.697374558 + 24.06570982441908 * d) % 24; 17 | } 18 | 19 | L.Terminator = L.Polygon.extend({ 20 | options: { 21 | color: '#00', 22 | opacity: 0.5, 23 | fillColor: '#00', 24 | fillOpacity: 0.5, 25 | resolution: 2 26 | }, 27 | 28 | initialize: function(options) { 29 | this.version = '0.1.0'; 30 | this._R2D = 180 / Math.PI; 31 | this._D2R = Math.PI / 180; 32 | L.Util.setOptions(this, options); 33 | var latLng = this._compute(this.options.time || null) 34 | this.setLatLngs(latLng); 35 | }, 36 | 37 | setTime: function(date) { 38 | this.options.time = date; 39 | var latLng = this._compute(date || null) 40 | this.setLatLngs(latLng); 41 | }, 42 | 43 | _sunEclipticPosition: function(julianDay) { 44 | /* Compute the position of the Sun in ecliptic coordinates at 45 | julianDay. Following 46 | http://en.wikipedia.org/wiki/Position_of_the_Sun */ 47 | // Days since start of J2000.0 48 | var n = julianDay - 2451545.0; 49 | // mean longitude of the Sun 50 | var L = 280.460 + 0.9856474 * n; 51 | L %= 360; 52 | // mean anomaly of the Sun 53 | var g = 357.528 + 0.9856003 * n; 54 | g %= 360; 55 | // ecliptic longitude of Sun 56 | var lambda = L + 1.915 * Math.sin(g * this._D2R) + 57 | 0.02 * Math.sin(2 * g * this._D2R); 58 | // distance from Sun in AU 59 | var R = 1.00014 - 0.01671 * Math.cos(g * this._D2R) - 60 | 0.0014 * Math.cos(2 * g * this._D2R); 61 | return {"lambda": lambda, "R": R}; 62 | }, 63 | 64 | _eclipticObliquity: function(julianDay) { 65 | // Following the short term expression in 66 | // http://en.wikipedia.org/wiki/Axial_tilt#Obliquity_of_the_ecliptic_.28Earth.27s_axial_tilt.29 67 | var n = julianDay - 2451545.0; 68 | // Julian centuries since J2000.0 69 | var T = n / 36525; 70 | var epsilon = 23.43929111 - 71 | T * (46.836769 / 3600 72 | - T * (0.0001831 / 3600 73 | + T * (0.00200340 / 3600 74 | - T * (0.576e-6 / 3600 75 | - T * 4.34e-8 / 3600)))); 76 | return epsilon; 77 | }, 78 | 79 | _sunEquatorialPosition: function(sunEclLng, eclObliq) { 80 | /* Compute the Sun's equatorial position from its ecliptic 81 | * position. Inputs are expected in degrees. Outputs are in 82 | * degrees as well. */ 83 | var alpha = Math.atan(Math.cos(eclObliq * this._D2R) 84 | * Math.tan(sunEclLng * this._D2R)) * this._R2D; 85 | var delta = Math.asin(Math.sin(eclObliq * this._D2R) 86 | * Math.sin(sunEclLng * this._D2R)) * this._R2D; 87 | 88 | var lQuadrant = Math.floor(sunEclLng / 90) * 90; 89 | var raQuadrant = Math.floor(alpha / 90) * 90; 90 | alpha = alpha + (lQuadrant - raQuadrant); 91 | 92 | return {"alpha": alpha, "delta": delta}; 93 | }, 94 | 95 | _hourAngle: function(lng, sunPos, gst) { 96 | /* Compute the hour angle of the sun for a longitude on 97 | * Earth. Return the hour angle in degrees. */ 98 | var lst = gst + lng / 15; 99 | return lst * 15 - sunPos.alpha; 100 | }, 101 | 102 | _latitude: function(ha, sunPos) { 103 | /* For a given hour angle and sun position, compute the 104 | * latitude of the terminator in degrees. */ 105 | var lat = Math.atan(-Math.cos(ha * this._D2R) / 106 | Math.tan(sunPos.delta * this._D2R)) * this._R2D; 107 | return lat; 108 | }, 109 | 110 | _compute: function(time) { 111 | if (time == null) 112 | var today = new Date(); 113 | else 114 | var today = new Date(time); 115 | var julianDay = today.getJulian(); 116 | var gst = today.getGMST(); 117 | var latLng = []; 118 | var ha, lat; 119 | 120 | var sunEclPos = this._sunEclipticPosition(julianDay); 121 | var eclObliq = this._eclipticObliquity(julianDay); 122 | var sunEqPos = this._sunEquatorialPosition(sunEclPos.lambda, eclObliq); 123 | for (var i = 0; i <= 720 * this.options.resolution; i++) { 124 | lng = -360 + i / this.options.resolution; 125 | ha = this._hourAngle(lng, sunEqPos, gst); 126 | lat = this._latitude(ha, sunEqPos); 127 | latLng[i+1] = [lat, lng]; 128 | } 129 | if (sunEqPos.delta < 0) { 130 | latLng[0] = [90, -360]; 131 | latLng[latLng.length] = [90, 360]; 132 | } else { 133 | latLng[0] = [-90, -360]; 134 | latLng[latLng.length] = [-90, 360]; 135 | } 136 | return latLng; 137 | } 138 | }); 139 | 140 | L.terminator = function(options) { 141 | return new L.Terminator(options); 142 | }; 143 | 144 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.Terminator/Terminator-binding.js: -------------------------------------------------------------------------------- 1 | LeafletWidget.methods.addTerminator = function(resolution, time, 2 | layerId, group, options) { 3 | (function() { 4 | this.layerManager.addLayer( 5 | L.terminator($.extend({ 6 | resolution: resolution, 7 | time: time, 8 | group: group 9 | }, options || {})), 10 | 'shape', layerId, group); 11 | }).call(this); 12 | }; 13 | 14 | 15 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/ionicons.eot -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/ionicons.ttf -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/fonts/ionicons.woff -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-matte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-matte.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-matte@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-matte@2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-plain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-plain.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-shadow.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-shadow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-shadow@2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-soft.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-soft@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-spatial/mapview/ef27cac96515f55a901f686c239682c0b09cf398/vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/images/markers-soft@2x.png -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/leaflet.awesome-markers.css: -------------------------------------------------------------------------------- 1 | /* 2 | Author: L. Voogdt 3 | License: MIT 4 | Version: 1.0 5 | */ 6 | 7 | /* Marker setup */ 8 | .awesome-marker { 9 | background: url('images/markers-soft.png') no-repeat 0 0; 10 | width: 35px; 11 | height: 46px; 12 | position:absolute; 13 | left:0; 14 | top:0; 15 | display: block; 16 | text-align: center; 17 | } 18 | 19 | .awesome-marker-shadow { 20 | background: url('images/markers-shadow.png') no-repeat 0 0; 21 | width: 36px; 22 | height: 16px; 23 | } 24 | 25 | /* Retina displays */ 26 | @media (min--moz-device-pixel-ratio: 1.5),(-o-min-device-pixel-ratio: 3/2), 27 | (-webkit-min-device-pixel-ratio: 1.5),(min-device-pixel-ratio: 1.5),(min-resolution: 1.5dppx) { 28 | .awesome-marker { 29 | background-image: url('images/markers-soft@2x.png'); 30 | background-size: 720px 92px; 31 | } 32 | .awesome-marker-shadow { 33 | background-image: url('images/markers-shadow@2x.png'); 34 | background-size: 35px 16px; 35 | } 36 | } 37 | 38 | .awesome-marker i { 39 | color: #333; 40 | margin-top: 10px; 41 | display: inline-block; 42 | font-size: 14px; 43 | } 44 | 45 | .awesome-marker .icon-white { 46 | color: #fff; 47 | } 48 | 49 | /* Colors */ 50 | .awesome-marker-icon-red { 51 | background-position: 0 0; 52 | } 53 | 54 | .awesome-marker-icon-darkred { 55 | background-position: -180px 0; 56 | } 57 | 58 | .awesome-marker-icon-lightred { 59 | background-position: -360px 0; 60 | } 61 | 62 | .awesome-marker-icon-orange { 63 | background-position: -36px 0; 64 | } 65 | 66 | .awesome-marker-icon-beige { 67 | background-position: -396px 0; 68 | } 69 | 70 | .awesome-marker-icon-green { 71 | background-position: -72px 0; 72 | } 73 | 74 | .awesome-marker-icon-darkgreen { 75 | background-position: -252px 0; 76 | } 77 | 78 | .awesome-marker-icon-lightgreen { 79 | background-position: -432px 0; 80 | } 81 | 82 | .awesome-marker-icon-blue { 83 | background-position: -108px 0; 84 | } 85 | 86 | .awesome-marker-icon-darkblue { 87 | background-position: -216px 0; 88 | } 89 | 90 | .awesome-marker-icon-lightblue { 91 | background-position: -468px 0; 92 | } 93 | 94 | .awesome-marker-icon-purple { 95 | background-position: -144px 0; 96 | } 97 | 98 | .awesome-marker-icon-darkpurple { 99 | background-position: -288px 0; 100 | } 101 | 102 | .awesome-marker-icon-pink { 103 | background-position: -504px 0; 104 | } 105 | 106 | .awesome-marker-icon-cadetblue { 107 | background-position: -324px 0; 108 | } 109 | 110 | .awesome-marker-icon-white { 111 | background-position: -576px 0; 112 | } 113 | 114 | .awesome-marker-icon-gray { 115 | background-position: -648px 0; 116 | } 117 | 118 | .awesome-marker-icon-lightgray { 119 | background-position: -612px 0; 120 | } 121 | 122 | .awesome-marker-icon-black { 123 | background-position: -682px 0; 124 | } 125 | 126 | .awesome-marker-square { 127 | background-position-y: -46px; 128 | } 129 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.awesome-markers/leaflet.awesome-markers.min.js: -------------------------------------------------------------------------------- 1 | (function(window,document,undefined){"use strict";L.AwesomeMarkers={};L.AwesomeMarkers.version="2.0.1";L.AwesomeMarkers.Icon=L.Icon.extend({options:{iconSize:[35,45],iconAnchor:[17,42],popupAnchor:[1,-32],shadowAnchor:[10,12],shadowSize:[36,16],className:"awesome-marker",prefix:"glyphicon",spinClass:"fa-spin",extraClasses:"",icon:"home",markerColor:"blue",iconColor:"white",iconRotate:0,font:"monospace"},initialize:function(options){options=L.Util.setOptions(this,options)},createIcon:function(){var div=document.createElement("div"),options=this.options;if(options.icon){div.innerHTML=this._createInner()}if(options.bgPos){div.style.backgroundPosition=-options.bgPos.x+"px "+-options.bgPos.y+"px"}this._setIconStyles(div,"icon-"+options.markerColor);return div},_createInner:function(){var iconClass,iconSpinClass="",iconColorClass="",iconColorStyle="",options=this.options;if(!options.prefix||options.icon.slice(0,options.prefix.length+1)===options.prefix+"-"){iconClass=options.icon}else{iconClass=options.prefix+"-"+options.icon}if(options.spin&&typeof options.spinClass==="string"){iconSpinClass=options.spinClass}if(options.iconColor){if((options.iconColor==="white"||options.iconColor==="black")&&options.prefix!=="fa"){iconColorClass="icon-"+options.iconColor}else if(options.prefix==="fa"&&options.iconColor==="white"){iconColorClass="fa-inverse"}else{iconColorStyle="color: "+options.iconColor+";"}}if(options.font&&options.text){iconColorStyle+="font-family: "+options.font+";"}if(options.iconRotate&&options.iconRotate!==0){iconColorStyle+="-webkit-transform: rotate("+options.iconRotate+"deg);";iconColorStyle+="-moz-transform: rotate("+options.iconRotate+"deg);";iconColorStyle+="-o-transform: rotate("+options.iconRotate+"deg);";iconColorStyle+="-ms-transform: rotate("+options.iconRotate+"deg);";iconColorStyle+="transform: rotate("+options.iconRotate+"deg);"}if(options.text){return""+options.text+""}return""},_setIconStyles:function(img,name){var options=this.options,size=L.point(options[name==="shadow"?"shadowSize":"iconSize"]),anchor;if(name==="shadow"){anchor=L.point(options.shadowAnchor||options.iconAnchor)}else{anchor=L.point(options.iconAnchor)}if(!anchor&&size){anchor=size.divideBy(2,true)}img.className="awesome-marker-"+name+" "+options.className;if(anchor){img.style.marginLeft=-anchor.x+"px";img.style.marginTop=-anchor.y+"px"}if(size){img.style.width=size.x+"px";img.style.height=size.y+"px"}},createShadow:function(){var div=document.createElement("div");this._setIconStyles(div,"shadow");return div}});L.AwesomeMarkers.icon=function(options){return new L.AwesomeMarkers.Icon(options)}})(this,document); 2 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.markercluster/MIT-LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012 David Leaver 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.markercluster/MarkerCluster.Default.css: -------------------------------------------------------------------------------- 1 | .marker-cluster-small { 2 | background-color: rgba(181, 226, 140, 0.6); 3 | } 4 | .marker-cluster-small div { 5 | background-color: rgba(110, 204, 57, 0.6); 6 | } 7 | 8 | .marker-cluster-medium { 9 | background-color: rgba(241, 211, 87, 0.6); 10 | } 11 | .marker-cluster-medium div { 12 | background-color: rgba(240, 194, 12, 0.6); 13 | } 14 | 15 | .marker-cluster-large { 16 | background-color: rgba(253, 156, 115, 0.6); 17 | } 18 | .marker-cluster-large div { 19 | background-color: rgba(241, 128, 23, 0.6); 20 | } 21 | 22 | /* IE 6-8 fallback colors */ 23 | .leaflet-oldie .marker-cluster-small { 24 | background-color: rgb(181, 226, 140); 25 | } 26 | .leaflet-oldie .marker-cluster-small div { 27 | background-color: rgb(110, 204, 57); 28 | } 29 | 30 | .leaflet-oldie .marker-cluster-medium { 31 | background-color: rgb(241, 211, 87); 32 | } 33 | .leaflet-oldie .marker-cluster-medium div { 34 | background-color: rgb(240, 194, 12); 35 | } 36 | 37 | .leaflet-oldie .marker-cluster-large { 38 | background-color: rgb(253, 156, 115); 39 | } 40 | .leaflet-oldie .marker-cluster-large div { 41 | background-color: rgb(241, 128, 23); 42 | } 43 | 44 | .marker-cluster { 45 | background-clip: padding-box; 46 | border-radius: 20px; 47 | } 48 | .marker-cluster div { 49 | width: 30px; 50 | height: 30px; 51 | margin-left: 5px; 52 | margin-top: 5px; 53 | 54 | text-align: center; 55 | border-radius: 15px; 56 | font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif; 57 | } 58 | .marker-cluster span { 59 | line-height: 30px; 60 | } -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.markercluster/MarkerCluster.css: -------------------------------------------------------------------------------- 1 | .leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow { 2 | -webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in; 3 | -moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in; 4 | -o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in; 5 | transition: transform 0.3s ease-out, opacity 0.3s ease-in; 6 | } 7 | 8 | .leaflet-cluster-spider-leg { 9 | /* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */ 10 | -webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in; 11 | -moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in; 12 | -o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in; 13 | transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in; 14 | } 15 | -------------------------------------------------------------------------------- /vignettes/popup_graphs/tmp_1_files/leaflet-binding-2.0.0.9000/plugins/Leaflet.markercluster/leaflet.markercluster.freezable.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Leaflet.MarkerCluster.Freezable 1.0.0+9db80a3 3 | (c) 2015-2016 Boris Seang 4 | License MIT 5 | */ 6 | !function(e,i){"function"==typeof define&&define.amd?define(["leaflet"],i):i("object"==typeof module&&module.exports?require("leaflet"):e.L)}(this,function(e,i){e.MarkerClusterGroup.include({_originalOnAddFreezable:e.MarkerClusterGroup.prototype.onAdd,onAdd:function(e){var i=this._zoom;this._originalOnAddFreezable(e),this._frozen&&(i>=0&&i!==this._zoom&&(this._featureGroup.clearLayers(),this._zoom=i,this.addLayers([])),e.off("zoomend",this._zoomEnd,this),e.off("moveend",this._moveEnd,this),e.on("zoomend moveend",this._viewChangeEndNotClustering,this))},_originalOnRemove:e.MarkerClusterGroup.prototype.onRemove,onRemove:function(e){e.off("zoomend moveend",this._viewChangeEndNotClustering,this),this._originalOnRemove(e)},disableClustering:function(){return this.freezeAtZoom(this._maxZoom+1)},disableClusteringKeepSpiderfy:function(){return this.freezeAtZoom(this._maxZoom)},enableClustering:function(){return this.unfreeze()},unfreeze:function(){return this.freezeAtZoom(!1)},freezeAtZoom:function(e){this._processQueue();var o=this._map;e===i||e===!0||e!==e?e=o?Math.round(o.getZoom()):-1:"max"===e?e=this._maxZoom+1:"maxKeepSpiderfy"===e&&(e=this._maxZoom);var t="number"==typeof e;if(this._frozen){if(!t)return this._unfreeze(),this}else{if(!t)return this;this._initiateFreeze()}return this._artificialZoomSafe(this._zoom,e),this},_initiateFreeze:function(){var e=this._map;this._frozen=!0,e&&(e.off("zoomend",this._zoomEnd,this),e.off("moveend",this._moveEnd,this),e.on("zoomend moveend",this._viewChangeEndNotClustering,this))},_unfreeze:function(){var e=this._map;this._frozen=!1,e&&(e.off("zoomend moveend",this._viewChangeEndNotClustering,this),e.on("zoomend",this._zoomEnd,this),e.on("moveend",this._moveEnd,this),this._executeAfterUnspiderfy(function(){this._zoomEnd()},this))},_executeAfterUnspiderfy:function(e,i){return this._unspiderfy&&this._spiderfied?(this.once("animationend",function(){e.call(i)}),void this._unspiderfy()):void e.call(i)},_artificialZoomSafe:function(e,i){this._zoom=i,this._map&&e!==i&&this._executeAfterUnspiderfy(function(){this._artificialZoom(e,i)},this)},_artificialZoom:function(e,i){ei&&(this._animationStart(),this._animationZoomOut(e,i))},_viewChangeEndNotClustering:function(){var e=this._featureGroup,i=this._getExpandedVisibleBounds(),o=this._zoom;e.eachLayer(function(t){!i.contains(t._latlng)&&t.__parent&&t.__parent._zoom