diff --git a/.Rbuildignore b/.Rbuildignore index adeced32c..5fb938dd8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,5 +9,6 @@ ^README.Rmd ^\.ccache$ ^\.github$ -^tic\.R$ .vscode +^_pkgdown\.yml$ +^pkgdown$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 000000000..2d19fc766 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 000000000..02de96660 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,53 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + +name: R-CMD-check.yaml + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + # prevent rgl issues because no X11 display is available + RGL_USE_NULL: true + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 000000000..bfc9f4db3 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + release: + types: [published] + workflow_dispatch: + +name: pkgdown.yaml + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 000000000..e050312ff --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,61 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + +name: test-coverage.yaml + +permissions: read-all + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr, any::xml2 + needs: coverage + + - name: Test coverage + run: | + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) + shell: Rscript {0} + + - uses: codecov/codecov-action@v4 + with: + # Fail if error if not on PR, or if on PR and token is given + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/.github/workflows/tic.yml b/.github/workflows/tic.yml deleted file mode 100644 index 7db1d45c5..000000000 --- a/.github/workflows/tic.yml +++ /dev/null @@ -1,129 +0,0 @@ -## tic GitHub Actions template: custom-deploy -## revision date: 2020-08-06 -# [Custom header] -on: - workflow_dispatch: - push: - pull_request: - # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) - schedule: - # * is a special character in YAML so you have to quote this string - - cron: "0 4 * * *" - -name: tic - -jobs: - all: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - # use a different tic template type if you do not want to build on all listed platforms - - { os: ubuntu-latest, r: "release", pkgdown: "true", latex: "true" } - # [Custom matrix env var] - - { os: ubuntu-latest, r: "devel" } - - env: - # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - CRAN: ${{ matrix.config.cran }} - # make sure to run `tic::use_ghactions_deploy()` to set up deployment - TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }} - # prevent rgl issues because no X11 display is available - RGL_USE_NULL: true - # if you use bookdown or blogdown, replace "PKGDOWN" by the respective - # capitalized term. This also might need to be done in tic.R - BUILD_PKGDOWN: ${{ matrix.config.pkgdown }} - # macOS >= 10.15.4 linking - SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk - # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v2.3.1 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - Ncpus: 4 - - # LaTeX. Installation time: - # Linux: ~ 1 min - # macOS: ~ 1 min 30s - # Windows: never finishes - - uses: r-lib/actions/setup-tinytex@v2 - if: matrix.config.latex == 'true' - - - uses: r-lib/actions/setup-pandoc@v2 - - # set date/week for use in cache creation - # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970 - # - cache R packages daily - - name: "[Cache] Prepare daily timestamp for cache" - if: runner.os != 'Windows' - id: date - run: echo "::set-output name=date::$(date '+%d-%m')" - - - name: "[Cache] Cache R packages" - if: runner.os != 'Windows' - uses: pat-s/always-upload-cache@v2.1.0 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} - restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} - - # for some strange Windows reason this step and the next one need to be decoupled - - name: "[Stage] Prepare" - run: | - Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')" - Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')" - - - name: "[Stage] [Linux] Install curl" - if: runner.os == 'Linux' - run: sudo apt install libcurl4-openssl-dev libgit2-dev - - - name: "[Custom] [Stage] [Linux] Install pkgdown system lib req" - if: runner.os == 'Linux' && matrix.config.r == 'release' - run: sudo apt install libharfbuzz-dev libfribidi-dev - - - name: "[Custom block] Install spatial libraries" - if: runner.os == 'Linux' - run: sudo apt install libgdal-dev libproj-dev libgeos-dev libudunits2-dev - - - name: "[Stage] Install" - if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel' - run: Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" - - # macOS devel needs its own stage because we need to work with an option to suppress the usage of binaries - - name: "[Stage] Prepare & Install (macOS-devel)" - if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'devel' - run: | - echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile - Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" - - - name: "[Stage] Script" - run: Rscript -e 'tic::script()' - - - name: "[Stage] After Success" - if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release' - run: Rscript -e "tic::after_success()" - - - name: "[Stage] Upload R CMD check artifacts" - if: failure() - uses: actions/upload-artifact@v2.1.1 - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check - - name: "[Stage] Before Deploy" - run: | - Rscript -e "tic::before_deploy()" - - - name: "[Stage] Deploy" - run: Rscript -e "tic::deploy()" - - - name: "[Stage] After Deploy" - run: Rscript -e "tic::after_deploy()" diff --git a/.gitignore b/.gitignore index 667bc52f1..dd07fb807 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ waterways.shx inst/doc docs/ .vscode +docs diff --git a/DESCRIPTION b/DESCRIPTION index 3f9f75b25..6311f8558 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -78,7 +78,6 @@ Imports: sf, sp Suggests: - covr, knitr, later, leaflet.extras2, @@ -97,5 +96,6 @@ Suggests: ByteCompile: yes Encoding: UTF-8 LazyData: TRUE -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 SystemRequirements: GNU make +Roxygen: list(markdown = TRUE) diff --git a/NAMESPACE b/NAMESPACE index d3b333077..ada8ef0dc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,12 +1,9 @@ # Generated by roxygen2: do not edit by hand - -if(getRversion() >= "3.6.0") { - S3method(knitr::knit_print, mapview) -} else { - export(knit_print.mapview) -} - +S3method(checkAdjustProjection,Raster) +S3method(checkAdjustProjection,SpatialPointsDataFrame) +S3method(checkAdjustProjection,sf) +S3method(knitr::knit_print,mapview) export(mapViewPalette) export(mapshot) export(mapshot2) diff --git a/NEWS.md b/NEWS.md index 100a5e677..e54127a21 100644 --- a/NEWS.md +++ b/NEWS.md @@ -76,15 +76,15 @@ new features: * new function removeMapJunk to remove control elements from a map (e.g. the zoom control). * added tentative support for platform 'leafgl'. - * stars method now uses leafem::addGeoRaster. https://github.com/r-spatial/leafem/issues/25 - * leafem::addCopyExtent now included in all methods. - * sf(c) methods now use leafem::addFgb if GDAL >= 3.1. + * stars method now uses `leafem::addGeoRaster()`. https://github.com/r-spatial/leafem/issues/25 + * `leafem::addCopyExtent()` now included in all methods. + * sf(c) methods now use `leafem::addFgb()` if GDAL >= 3.1. * new | operator to compare two maps side-by-side. miscellaneous: * all deprecated functions are now defunct. See ?`mapview-defunct`. - * drop viridisLite dependency and use base::hcl.colors instead. We now depend on R >= 3.6. + * drop viridisLite dependency and use `base::hcl.colors()` instead. We now depend on R >= 3.6. ## mapview 2.7.8 @@ -112,7 +112,7 @@ miscellaneous: * addMouseCoordinates now also displays native coordinates for leaflet maps. #205 - now moved to package leafem. * deprecated slideview, cubeview, latticeview & sync, plainview, popup* functions. - * deprecated addFeatures, garnishMap, addHomeButton, addImageQuery, addLogo, addMouseCoordinates. + * deprecated `addFeatures`, `garnishMap`, `addHomeButton`, `addImageQuery`, `addLogo`, `addMouseCoordinates`. bugfixes: @@ -139,7 +139,7 @@ bugfixes: * isFALSE (caused errors on R < 3.5) is now handled properly. * mapshot does not unintentionally delete url anymore if saving to png with same name. * mapshot now properly deletes temporary url when saving to png (or png and html). - * internal function mapview:::nrings now calculates number of polygon rings correctly. #181 + * internal function `mapview:::nrings` now calculates number of polygon rings correctly. #181 ## mapview 2.5.0 @@ -156,12 +156,12 @@ new features: bugfixes: - * leaflet::addScalebar would prevent Raster* method from rendering correctly for multiple layers. + * `leaflet::addScalebar()` would prevent Raster* method from rendering correctly for multiple layers. * cex was not respected when burst = TRUE. #149 - * popupTable no longer causes a stack overflow with large point data. #154 - * popupGraph no longer relies on png files on disk but embeds graphs via base64. #156 + * `popupTable()` no longer causes a stack overflow with large point data. #154 + * `popupGraph()` no longer relies on png files on disk but embeds graphs via base64. #156 * in mapshot, remove temporary url files only if remove_url = TRUE. #157 - * removeMouseCoordinates should work properly now (also exported). #145 + * `removeMouseCoordinates()` should work properly now (also exported). #145 * home button for single point now zooms to maximum zoom 18. miscellaneous: @@ -227,7 +227,7 @@ new features: * we now have mapview method for class 'numeric' which enables interactive plots of a numeric variable. * updated slideView to accommodate more than one incident in a flexdashboard #95 * if supplied data has only one attribute/field column mapview will now colour the plot automatically according to that attribute/field. - * new mapview method for class 'bbox' -> mapview(st_bbox(x)) is equivalent to viewExtent(x) + * new mapview method for class 'bbox' -> `mapview(st_bbox(x))` is equivalent to `viewExtent(x)` * plainview now provides mouse coordinates enhancements: @@ -247,22 +247,22 @@ new features: bugfixes: - * na.alpha caused list/burst methods to fail. - * legend did not work when zcol only had one unique value. This was actually a delibarate choice as for a single map it doesn't really make sense to have a legend for only one color. However, for latticeView/sync this does actually make sense, hence re-enabled. + * `na.alpha` caused list/burst methods to fail. + * legend did not work when zcol only had one unique value. This was actually a deliberate choice as for a single map it doesn't really make sense to have a legend for only one color. However, for latticeView/sync this does actually make sense, hence re-enabled. ## mapview 2.1.0 new features: - * plainview/cubeview now respects/has gained argument na.color. - * mapview now supports st_GEOMETRY with truely mixed feature types (e.g. LINESTRING and POLYGON) - fixes #85 - * addFeatures: one function to add them all. Type agnostic version of leaflet::add* functions for simple features objects. + * plainview/cubeview now respects/has gained argument `na.color`. + * mapview now supports st_GEOMETRY with truly mixed feature types (e.g. LINESTRING and POLYGON) - fixes #85 + * `addFeatures()`: one function to add them all. Type agnostic version of leaflet::add* functions for simple features objects. * mapview (for vector data only) has gained argument na.alpha to control opacity of missing values. bugfixes: * deleted obsolete data.table import. - * fixed #79: colnames of popupTables are now converted to utf-8. + * fixed #79: colnames of popup Tables are now converted to utf-8. * fixed #78: respect explicit setting of 'layer.name' argument. * included NEWS file as R-help doesn't render NEWS.md * highlight now respects alpha/alpha.regions = 0 @@ -331,7 +331,7 @@ new features: * mapshot: to save maps as html page or static image or both. * knitr integration (i.e. no need to call the @map slot anymore to render in knitr). * cubeView: view raster bricks or stacks hovmoeller style, use keys up & down, left & right, page up & page down to navigate through y, x, z dimensions, respectively. - * labels: if zcol is set, mouseover will now show the repesctive values of zcol, if zcol is not set moseover shows feature ID. Only available if suitable leaflet package version is installed. + * labels: if zcol is set, mouseover will now show the respective values of zcol, if zcol is not set moseover shows feature ID. Only available if suitable leaflet package version is installed. * new popup functions popupTable, popupGraph and popupImage. * functions to turn coordinates into spatial lines or spatial polygons. * mapview objects now work natively on shiny applications (i.e. renderMapview and mapviewOutput now available). diff --git a/R/color.R b/R/color.R index 770a03979..363f27405 100644 --- a/R/color.R +++ b/R/color.R @@ -6,13 +6,13 @@ #' specified in at #' @param at numeric vector giving the breakpoints for the colors #' @param na.color the color for NA values. -#' @param ... additional arguments passed on to \code{\link{level.colors}} +#' @param ... additional arguments passed on to \code{\link[lattice]{level.colors}} #' #' @author #' Tim Appelhans #' #' @seealso -#' \code{\link{level.colors}} +#' \code{\link[lattice]{level.colors}} #' #' @name mapviewColors #' @export mapviewColors diff --git a/R/cubeView.R b/R/cubeView.R index f5e737f63..f87ae3887 100644 --- a/R/cubeView.R +++ b/R/cubeView.R @@ -2,8 +2,8 @@ # #' # #' @param x a RasterStack or RasterBrick # #' @param at the breakpoints used for the visualisation. See -# #' \code{\link{levelplot}} for details. -# #' @param col.regions color (palette).See \code{\link{levelplot}} for details. +# #' \code{\link[lattice]{levelplot}} for details. +# #' @param col.regions color (palette).See \code{\link[lattice]{levelplot}} for details. # #' @param na.color color for missing values. # #' @param legend logical. Whether to plot a legend. # #' @param ... currently not used. diff --git a/R/extent.R b/R/extent.R index 5d71b8925..f9b5ef7b5 100644 --- a/R/extent.R +++ b/R/extent.R @@ -7,13 +7,13 @@ #' @param map a leaflet or mapview map the extent should be added to. If NULL #' standard background layers are created. #' @param popup a \code{list} of HTML strings with the popup contents, usually -#' created from \code{\link{popupTable}}. See \code{\link{addControl}} for +#' created from \code{\link[leafpop]{popupTable}}. See \code{\link[leaflet]{addControl}} for #' details. #' @param layer.name the name of the layer to be shown on the map. #' @param alpha.regions opacity of the fills or the raster layer(s). #' @param label a character vector of labels to be shown on mouseover. See -#' \code{\link{addControl}} for details. -#' @param ... additional arguments passed on to \code{\link{addRectangles}} +#' \code{\link[leaflet]{addControl}} for details. +#' @inheritDotParams leaflet::addRectangles #' #' @author #' Tim Appelhans @@ -27,7 +27,6 @@ #' leaflet() %>% addProviderTiles("OpenStreetMap") %>% leafem::addExtent(breweries) #' leaflet() %>% addProviderTiles("OpenStreetMap") %>% leafem::addExtent(breweries) #' -#' @export viewExtent #' @name viewExtent #' @aliases viewExtent #' @@ -35,6 +34,7 @@ NULL ## View Extent ============================================================ #' @rdname viewExtent +#' @export viewExtent <- function(x, map = NULL, popup = NULL, diff --git a/R/mapView.R b/R/mapView.R index fb8128cb7..ddee2d999 100644 --- a/R/mapView.R +++ b/R/mapView.R @@ -29,7 +29,7 @@ if ( !isGeneric('mapView') ) { #' @param map an optional existing map to be updated/added to. #' @param band for stars layers, the band number to be plotted. #' @param pane name of the map pane in which to render features. See -#' \code{\link{addMapPane}} for details. Currently only supported for vector layers. +#' \code{\link[leaflet]{addMapPane}} for details. Currently only supported for vector layers. #' Ignored if \code{canvas = TRUE}. The default \code{"auto"} will create different panes #' for points, lines and polygons such that points overlay lines overlay polygons. #' Set to \code{NULL} to get default leaflet behaviour where allfeatures @@ -44,12 +44,12 @@ if ( !isGeneric('mapView') ) { #' If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting. #' @param color color (palette) for points/polygons/lines #' @param col.regions color (palette) pixels. -#' See \code{\link{levelplot}} for details. +#' See \code{\link[lattice]{levelplot}} for details. #' @param at the breakpoints used for the visualisation. -#' See \code{\link{levelplot}} for details. +#' See \code{\link[lattice]{levelplot}} for details. #' @param na.color color for missing values #' @param use.layer.names should layer names of the Raster* object be used? -#' @param map.types character spcifications for the base maps. +#' @param map.types character specifications for the base maps. #' see \url{https://leaflet-extras.github.io/leaflet-providers/preview/} #' for available options. #' @param burst whether to show all (TRUE) or only one (FALSE) layer(s). @@ -75,13 +75,13 @@ if ( !isGeneric('mapView') ) { #' Defaults to TRUE #' @param popup either \code{logical}, \code{character vector} or a \code{list} #' of HTML strings with the popup contents, usually created from -#' \code{\link[leafpop]{popupTable}}. See \code{\link{addControl}} for details. +#' \code{\link[leafpop]{popupTable}}. See \code{\link[leaflet]{addControl}} for details. #' If \code{FALSE} or \code{NULL} no popups will be created, if \code{TRUE} #' a table with all feature attributes/columns will be created. #' If a \code{character vector} of column names, the table will only show the #' respective column entries. #' @param label For vector data (sf/sp) a character vector of labels to be -#' shown on mouseover. See \code{\link{addControl}} for details. For raster +#' shown on mouseover. See \code{\link[leaflet]{addControl}} for details. For raster #' data (Raster*/stars) a logical indicating whether to add image query. #' @param native.crs logical whether to reproject to web map coordinate #' reference system (web mercator - epsg:3857) or render using native CRS of @@ -98,7 +98,7 @@ if ( !isGeneric('mapView') ) { #' layer is of class \code{factor} in which case "ngb" is used. #' @param highlight either \code{FALSE}, \code{NULL} or a list of styling #' options for feature highlighting on mouse hover. -#' See \code{\link{highlightOptions}} for details. +#' See \code{\link[leaflet]{highlightOptions}} for details. #' @param maxpoints the maximum number of points making up the geometry. #' In case of lines and polygons this refers to the number of vertices. See #' Details for more information. @@ -107,21 +107,21 @@ if ( !isGeneric('mapView') ) { #' @param query.digits for raster methods only. The amount of digits to be shown #' by raster value query. Ignored if \code{label = FALSE}. #' @param query.position for raster methods only. The position of the raster -#' value query info box. See \code{position} argument of \code{\link{addLegend}} +#' value query info box. See \code{position} argument of \code{\link[leaflet]{addLegend}} #' for possible values. Ignored if \code{label = FALSE}. #' @param query.prefix for raster methods only. a character string to be shown #' as prefix for the layerId. Ignored if \code{label = FALSE}. #' @param hide either a logical, a vector of layer names or a vector of layer indices. #' See Details for more information on what exactly it does for different raster types. #' @param ... additional arguments passed on to respective functions. -#' See \code{\link{addRasterImage}}, \code{\link{addCircles}}, -#' \code{\link{addPolygons}}, \code{\link{addPolylines}} for details. +#' See \code{\link[leaflet]{addRasterImage}}, \code{\link[leaflet]{addCircles}}, +#' \code{\link[leaflet]{addPolygons}}, \code{\link[leaflet]{addPolylines}} for details. #' Furthermore, you can pass hidden arguments to some methods. See Details for #' a list of supported hidden arguments. #' #' @details #' \code{maxpoints} is taken to determine when to switch rendering from svg -#' to canvas overlay for perfomance. The threshold calculation is done as follows: \cr +#' to canvas overlay for performance. The threshold calculation is done as follows: \cr #' if the number of points (in case of point data) or vertices (in case of #' polygon or line data) > \code{maxpoints} then render using special render #' function. Within this render function we approximate the complexity of @@ -460,7 +460,7 @@ setMethod('mapView', signature(x = 'SpatRaster'), .stars_method) ## Raster Stack/Brick =========================================================== -#' @describeIn mapView \code{\link{stack}} / \code{\link{brick}} +#' @describeIn mapView \code{\link[raster]{stack}} / \code{\link[raster]{brick}} setMethod('mapView', signature(x = 'RasterStackBrick'), function(x, @@ -531,7 +531,7 @@ setMethod('mapView', signature(x = 'RasterStackBrick'), ## Satellite object ======================================================= -#' @describeIn mapView \code{\link{satellite}} +#' @describeIn mapView \code{\link[satellite]{satellite}} setMethod('mapView', signature(x = 'Satellite'), function(x, @@ -840,7 +840,7 @@ setMethod('mapView', signature(x = 'SpatVector'), .sf_method) ## sfc ==================================================================== -#' @describeIn mapView \code{\link{st_sfc}} +#' @describeIn mapView \code{\link[sf]{st_sfc}} setMethod('mapView', signature(x = 'sfc'), function(x, @@ -1105,10 +1105,10 @@ setMethod('mapView', signature(x = 'numeric'), #' data.frame method. #' @param grid whether to plot a (scatter plot) xy-grid to aid interpretation #' of the visualisation. Only relevant for the data.frame method. -#' @param aspect the ratio of x/y axis corrdinates to adjust the plotting +#' @param aspect the ratio of x/y axis coordinates to adjust the plotting #' space to fit the screen. Only relevant for the data.frame method. #' @param crs an optional crs specification for the provided data to enable -#' rendering on a basemap. See argument description in \code{\link{st_sf}} +#' rendering on a basemap. See argument description in \code{\link[sf]{st_sf}} #' for details. setMethod('mapView', signature(x = 'data.frame'), function(x, @@ -1151,7 +1151,7 @@ setMethod('mapView', signature(x = 'data.frame'), ## XY ===================================================================== -#' @describeIn mapView \code{\link{st_sfc}} +#' @describeIn mapView \code{\link[sf]{st_sfc}} setMethod('mapView', signature(x = 'XY'), function(x, @@ -1219,7 +1219,7 @@ setMethod('mapView', signature(x = 'XY'), ## XYZ ==================================================================== -#' @describeIn mapView \code{\link{st_sfc}} +#' @describeIn mapView \code{\link[sf]{st_sfc}} setMethod('mapView', signature(x = 'XYZ'), function(x, @@ -1233,7 +1233,7 @@ setMethod('mapView', signature(x = 'XYZ'), ## XYM ==================================================================== -#' @describeIn mapView \code{\link{st_sfc}} +#' @describeIn mapView \code{\link[sf]{st_sfc}} setMethod('mapView', signature(x = 'XYM'), function(x, @@ -1247,7 +1247,7 @@ setMethod('mapView', signature(x = 'XYM'), ## XYZM =================================================================== -#' @describeIn mapView \code{\link{st_sfc}} +#' @describeIn mapView \code{\link[sf]{st_sfc}} setMethod('mapView', signature(x = 'XYZM'), function(x, @@ -1261,7 +1261,7 @@ setMethod('mapView', signature(x = 'XYZM'), ## bbox ======================================================= -#' @describeIn mapView \code{\link{st_bbox}} +#' @describeIn mapView \code{\link[sf]{st_bbox}} setMethod('mapView', signature(x = 'bbox'), function(x, @@ -1416,7 +1416,7 @@ setMethod('mapview', signature('ANY'), ######## SP ############################################################### ## SpatialPixelsDataFrame ================================================= -#' @describeIn mapView \code{\link{SpatialPixelsDataFrame}} +#' @describeIn mapView \code{\link[sp]{SpatialPixelsDataFrame}} #' setMethod('mapView', signature(x = 'SpatialPixelsDataFrame'), function(x, @@ -1482,7 +1482,7 @@ setMethod('mapView', signature(x = 'SpatialPixelsDataFrame'), ## SpatialGridDataFrame ================================================= -#' @describeIn mapView \code{\link{SpatialGridDataFrame}} +#' @describeIn mapView \code{\link[sp]{SpatialGridDataFrame}} #' setMethod('mapView', signature(x = 'SpatialGridDataFrame'), function(x, @@ -1548,7 +1548,7 @@ setMethod('mapView', signature(x = 'SpatialGridDataFrame'), ## SpatialPointsDataFrame ================================================= -#' @describeIn mapView \code{\link{SpatialPointsDataFrame}} +#' @describeIn mapView \code{\link[sp]{SpatialPointsDataFrame}} setMethod('mapView', signature(x = 'SpatialPointsDataFrame'), function(x, zcol = NULL, @@ -1562,7 +1562,7 @@ setMethod('mapView', signature(x = 'SpatialPointsDataFrame'), ## SpatialPoints ========================================================== -#' @describeIn mapView \code{\link{SpatialPoints}} +#' @describeIn mapView \code{\link[sp]{SpatialPoints}} setMethod('mapView', signature(x = 'SpatialPoints'), function(x, @@ -1577,7 +1577,7 @@ setMethod('mapView', signature(x = 'SpatialPoints'), ## SpatialPolygonsDataFrame =============================================== -#' @describeIn mapView \code{\link{SpatialPolygonsDataFrame}} +#' @describeIn mapView \code{\link[sp]{SpatialPolygonsDataFrame}} setMethod('mapView', signature(x = 'SpatialPolygonsDataFrame'), function(x, @@ -1592,7 +1592,7 @@ setMethod('mapView', signature(x = 'SpatialPolygonsDataFrame'), ## SpatialPolygons ======================================================== -#' @describeIn mapView \code{\link{SpatialPolygons}} +#' @describeIn mapView \code{\link[sp]{SpatialPolygons}} setMethod('mapView', signature(x = 'SpatialPolygons'), function(x, @@ -1607,7 +1607,7 @@ setMethod('mapView', signature(x = 'SpatialPolygons'), ## SpatialLinesDataFrame ================================================= -#' @describeIn mapView \code{\link{SpatialLinesDataFrame}} +#' @describeIn mapView \code{\link[sp]{SpatialLinesDataFrame}} setMethod('mapView', signature(x = 'SpatialLinesDataFrame'), function(x, @@ -1622,7 +1622,7 @@ setMethod('mapView', signature(x = 'SpatialLinesDataFrame'), ## SpatialLines =========================================================== -#' @describeIn mapView \code{\link{SpatialLines}} +#' @describeIn mapView \code{\link[sp]{SpatialLines}} setMethod('mapView', signature(x = 'SpatialLines'), function(x, diff --git a/R/mapshot.R b/R/mapshot.R index 3c196e808..cc7f08dab 100644 --- a/R/mapshot.R +++ b/R/mapshot.R @@ -170,8 +170,8 @@ mapshot = function(x, #' @param file Output \code{.png}, \code{.pdf}, or \code{.jpeg} file. #' @param remove_controls \code{character} vector of control buttons to be removed #' from the map when saving to file. Any combination of -#' "zoomControl", "layersControl", "homeButton", "scaleBar", "drawToolbar", -#' "easyButton". If set to \code{NULL} nothing will be removed. Ignored if \code{x} +#' `"zoomControl"`, `"layersControl"`, `"homeButton"`, `"scaleBar"`, `"drawToolbar"`, +#' `"easyButton"`. If set to \code{NULL} nothing will be removed. Ignored if \code{x} #' is not a mapview or leaflet map. #' @param ... Further arguments passed on to \code{\link[htmlwidgets]{saveWidget}} #' and/or \code{\link[webshot2]{webshot}}. diff --git a/R/mapview-package.R b/R/mapview-package.R index 2e8a665cd..ed412b90f 100644 --- a/R/mapview-package.R +++ b/R/mapview-package.R @@ -1,32 +1,17 @@ -#' Interactive viewing of spatial objects in R -#' -#' The package provides functionality to view spatial objects interactively. -#' The intention is to provide interactivity for easy and quick visualization -#' during spatial data analysis. It is not intended for fine-tuned presentation -#' quality map production. -#' -#' @name mapview-package -#' @docType package -#' @title Interactive viewing of spatial objects in R -#' @author Tim Appelhans, Florian Detsch, Chris Reudenbach, -#' Stephan Woellauer, Spaska Forteva, Thomas Nauss, -#' Environmental Informatics Marburg \cr -#' \cr -#' \emph{Maintainer:} Tim Appelhans \email{tim.appelhans@gmail.com} -#' #' @import leaflet sp sf raster satellite scales methods png lattice base64enc #' @importFrom grDevices rgb dev.off png svg colorRampPalette grey.colors #' @importFrom utils find glob2rx #' @importFrom utils modifyList #' -#' @keywords package -#' -NULL +#' @details +#' The package provides functionality to view spatial objects interactively. +#' The intention is to provide interactivity for easy and quick visualization +#' during spatial data analysis. It is not intended for fine-tuned presentation +#' quality map production. #' -#' @docType data -#' @name breweries -#' @title Selected breweries in Franconia -#' @description Selected breweries in Franconia +"_PACKAGE" + +#' Selected breweries in Franconia #' @details This dataset contains selected breweries in Franconia. It is partly a #' subset of a larger database that was compiled by students at the #' University of Marburg for a seminar called @@ -34,33 +19,29 @@ NULL #' and partly consists of breweries downloaded from #' \url{https://www.bierwandern.de/inhalt/brauereiliste.html} with the kind permission #' of Rainer Kastl. Note that use of these data is restricted to non-commercial use -#' and that they are explixitly excluded from the GPL lincense that mapview is licensed under. +#' and that they are explicitly excluded from the GPL license that mapview is licensed under. #' @format \code{sf feature collection POINT} -NULL +"breweries" + +#' Administrative district borders of Franconia #' -#' @docType data -#' @name franconia -#' @title Administrative district borders of Franconia -#' @description Administrative district borders of Franconia #' @details The NUTS_2013_01M_SH.zip archive was downloaded on 23/03/2017 from #' \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts}. #' \url{https://gist.github.com/tim-salabim/2845fa90813fa25c18cf83f9b88cbde0} #' @format \code{sf feature collection MULTIPOLYGON} #' @source #' \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts} -NULL +"franconia" + +#' Selected hiking trails in Franconia #' -#' @docType data -#' @name trails -#' @title Selected hiking trails in Franconia -#' @description Selected hiking trails in Franconia #' @details These hiking trails were downloaded on 06/04/2017 from #' \url{https://geoportal.bayern.de/bayernatlas} #' These data are published by the owner under Creative Commons Namensnennung 3.0 Deutschland, #' see \url{https://creativecommons.org/licenses/by/3.0/de/} for details. #' @format \code{sf feature collection MULTILINESTRING} #' @source -#' Datenquelle: Bayerische Vermessungsverwaltung - www.geodaten.bayern.de +#' Datenquelle: Bayerische Vermessungsverwaltung - `www.geodaten.bayern.de` #' \url{https://www.ldbv.bayern.de/produkte/weitere/opendata.html} -NULL +"trails" diff --git a/R/options.R b/R/options.R index dcc84a115..add4a32fa 100644 --- a/R/options.R +++ b/R/options.R @@ -29,23 +29,23 @@ #' @param legend logical. Whether or not to show a legend for the layer(s). #' @param legend.opacity opacity of the legend. #' @param legend.pos Where should the legend be placed? -#' One of "topleft", "topright", "bottomleft", "bottomright". +#' One of `"topleft"`, `"topright"`, `"bottomleft"`, `"bottomright"`. #' @param default logical. If TRUE all options are set to their default values #' @param console logical. Should the options be printed to the console #' @param layers.control.pos character. Where should the layer control be -#' placed? One of "topleft", "topright", "bottomleft", "bottomright". +#' placed? One of `"topleft"`, `"topright"`, `"bottomleft"`, `"bottomright"`. #' @param leafletWidth,leafletHeight height and width of the htmlwidget in px. #' @param viewer.suppress whether to render the map in the browser (\code{TRUE}) #' or the RStudio viewer (\code{FALSE}). #' @param homebutton logical, whether to add a zoom-to-layer button to the map. #' @param homebutton.pos character. Where should the homebutton(s) be -#' placed? One of "topleft", "topright", "bottomleft", "bottomright". +#' placed? One of `"topleft"`, `"topright"`, `"bottomleft"`, `"bottomright"`. #' @param native.crs logical whether to reproject to web map coordinate -#' reference system (web mercator - epsg:3857) or render using native CRS of +#' reference system (web Mercator - epsg:3857) or render using native CRS of #' the supplied data (can also be NA). Default is FALSE which will render in -#' web mercator. If set to TRUE now background maps will be drawn (but rendering +#' web Mercator. If set to TRUE now background maps will be drawn (but rendering #' may be much quicker as no reprojecting is necessary). -#' @param raster.size numeric. see the maxBytes argument in \code{\link{addRasterImage}} +#' @param raster.size numeric. see the maxBytes argument in \code{\link[leaflet]{addRasterImage}} #' @param mapview.maxpixels numeric. The maximum amount of pixels allowed for Raster* #' objects to be rendered with \code{mapview}. Defaults to 500000. #' Set this higher if you have a potent machine or are patient enough to wait a little. @@ -66,7 +66,7 @@ #' @param query.digits for raster methods only. The amount of digits to be shown #' by raster value query. Ignored if \code{label = FALSE}. #' @param query.position for raster methods only. The position of the raster -#' value query info box. See \code{position} argument of \code{\link{addLegend}} +#' value query info box. See \code{position} argument of \code{\link[leaflet]{addLegend}} #' for possible values. Ignored if \code{label = FALSE}. #' @param query.prefix for raster methods only. a character string to be shown #' as prefix for the layerId. Ignored if \code{label = FALSE}. @@ -86,10 +86,10 @@ #' This means that standard functionality is reduced. #' For example adding layers via "+" is not possible anymore. #' @param pane name of the map pane in which to render features. See -#' \code{\link{addMapPane}} for details. Currently only supported for vector layers. +#' \code{\link[leaflet]{addMapPane}} for details. Currently only supported for vector layers. #' Ignored if \code{canvas = TRUE}. The default \code{"auto"} will create different panes #' for points, lines and polygons such that points overlay lines overlay polygons. -#' Set to \code{NULL} to get default leaflet behaviour where allfeatures +#' Set to \code{NULL} to get default leaflet behaviour where all features #' are rendered in the same pane and layer order is determined automatically/sequentially. #' @param cex numeric or attribute name(s) or column number(s) in attribute table #' of the column(s) to be used for defining the size of circles. @@ -97,11 +97,11 @@ #' @param watch whether to watch a certain environment and automatically #' render changes to the list of spatial data in that environment. See #' \link{mapviewWatcher} for details. -#' @param fgb if set to \code{TRUE} mapview will not use 'clasical' leaflet/htmlwidgets +#' @param fgb if set to \code{TRUE} mapview will not use 'classical' leaflet/htmlwidgets #' rendering (which embeds data directly in the html) but leverage the speed of #' a file format called flatgeobuf (hence, fgb). This has the added benefit that #' data is being streamed onto the map, which makes for a pleasant user experience. -#' It should also help to visualise larger data sets due to a reduced memeory footprint. +#' It should also help to visualise larger data sets due to a reduced memory footprint. #' A note of warning, data will be attached to the html #' via a call which means that the html is not selfcontained anymore #' (so it cannot be used without an accompanying folder). @@ -118,7 +118,7 @@ #' If no arguments are provided the options are printed. #' #' @seealso -#' \code{\link{rasterOptions}}, \code{\link{options}} +#' \code{\link[raster]{rasterOptions}}, \code{\link{options}} #' #' @examples #' mapviewOptions() diff --git a/R/plainView.R b/R/plainView.R index 1aa05c0f4..d56791ec1 100644 --- a/R/plainView.R +++ b/R/plainView.R @@ -12,9 +12,9 @@ # #' @param x a \code{\link{raster}}* object # #' @param maxpixels integer > 0. Maximum number of cells to use for the plot. # #' If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting. -# #' @param col.regions color (palette).See \code{\link{levelplot}} for details. +# #' @param col.regions color (palette).See \code{\link[lattice]{levelplot}} for details. # #' @param at the breakpoints used for the visualisation. See -# #' \code{\link{levelplot}} for details. +# #' \code{\link[lattice]{levelplot}} for details. # #' @param na.color color for missing values. # #' @param legend either logical or a list specifying any of the components # #' decribed in the \code{colorkey} section of \link[lattice]{levelplot}. diff --git a/R/print.R b/R/print.R index fece87308..121c07237 100644 --- a/R/print.R +++ b/R/print.R @@ -85,13 +85,7 @@ setMethod("show", signature(object = "mapview"), #' @param x A mapview object #' @param ... further arguments passed on to \code{\link[knitr]{knit_print}} #' -#' @rawNamespace -#' if(getRversion() >= "3.6.0") { -#' S3method(knitr::knit_print, mapview) -#' } else { -#' export(knit_print.mapview) -#' } -#' +#' @exportS3Method knitr::knit_print knit_print.mapview = function(x, ...) { knitr::knit_print(mapview2leaflet(x), ...) } diff --git a/R/projection.R b/R/projection.R index b56160be6..7469a31c2 100644 --- a/R/projection.R +++ b/R/projection.R @@ -14,10 +14,12 @@ checkAdjustProjection <- function(x, ...) { UseMethod("checkAdjustProjection") } +#' @export checkAdjustProjection.Raster <- function(x, ...) { rasterCheckAdjustProjection(x, ...) } +#' @export checkAdjustProjection.SpatialPointsDataFrame <- checkAdjustProjection.SpatialPolygonsDataFrame <- checkAdjustProjection.SpatialLinesDataFrame <- @@ -27,6 +29,7 @@ checkAdjustProjection.SpatialPointsDataFrame <- spCheckAdjustProjection(x) } +#' @export checkAdjustProjection.sf <- checkAdjustProjection.sfc <- checkAdjustProjection.sfg <- function(x, ...) { diff --git a/R/shiny-mapview.R b/R/shiny-mapview.R index 0dfb9f3f5..e4f258309 100644 --- a/R/shiny-mapview.R +++ b/R/shiny-mapview.R @@ -2,7 +2,7 @@ #' #' @param expr An expression that generates an HTML widget #' @param env The environment in which to evaluate expr -#' @param quoted Is expr a quoted expression (with quote())? +#' @param quoted Is `expr` a quoted expression (with `quote()`)? #' This is useful if you want to save an expression in a variable #' #' @export @@ -19,7 +19,7 @@ renderMapview <- function(expr, env = parent.frame(), quoted = FALSE) { #' #' @param outputId Output variable to read from #' @param width,height the width and height of the map -#' (see \code{\link{shinyWidgetOutput}}) +#' (see \code{\link[htmlwidgets]{shinyWidgetOutput}}) #' #' @export #' diff --git a/R/slideView.R b/R/slideView.R index d3b34ab8d..15c0cc9b5 100644 --- a/R/slideView.R +++ b/R/slideView.R @@ -22,7 +22,7 @@ # #' If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting. # #' @param color the color palette to be used for visualising RasterLayers # #' @param na.color the color to be used for NA pixels -# #' @param col.regions color (palette).See \code{\link{levelplot}} for details. +# #' @param col.regions color (palette).See \code{\link[lattice]{levelplot}} for details. # #' @param legend whether to plot legends for the two images (ignored for # #' RatserStacks/*Bricks). # #' @param ... additional arguments passed on to repective functions. diff --git a/R/viewRGB.R b/R/viewRGB.R index de44be3ce..13c74466d 100644 --- a/R/viewRGB.R +++ b/R/viewRGB.R @@ -7,7 +7,7 @@ #' that they represent the red, green and blue channel. This function can #' be used to make 'true (or false) color images' from Landsat and other #' multi-band satellite images. Note, this text is plagiarized, i.e. copied -#' from \code{\link{plotRGB}}. +#' from [raster::plotRGB()]. #' #' @param x a RasterBrick, RasterStack #' @param r integer. Index of the Red channel/band, between 1 and nlayers(x) diff --git a/R/watch.R b/R/watch.R index f40256465..356eb8ce5 100644 --- a/R/watch.R +++ b/R/watch.R @@ -1,7 +1,7 @@ #' Start and/or stop automagic mapviewing of spatial objects in your workspace. #' #' @description -#' Use these functions to enable automatic vieweing of all spatial objects +#' Use these functions to enable automatic viewing of all spatial objects #' currently available in \code{env}. \code{mapviewWatcher} uses #' \link[later]{later} to set up a watcher function that continuously monitors #' \code{env} for spatial objects and refreshes the viewer/browser in case @@ -22,7 +22,7 @@ #' \code{mapviewWatcher()} once. To switch watching off it is sufficient to set #' \code{mapviewOptions(watch = FALSE)}. #' -#' @param env the environemnt that is being watched (default is \code{.GlobalEnv}). +#' @param env the environment that is being watched (default is \code{.GlobalEnv}). #' @param ... currently not used. #' #' @examples diff --git a/README.Rmd b/README.Rmd index cc8387317..6713c3128 100644 --- a/README.Rmd +++ b/README.Rmd @@ -13,16 +13,16 @@ knitr::opts_chunk$set( # mapview - -[![tic](https://github.com/r-spatial/mapview/workflows/tic/badge.svg?branch=master)](https://github.com/r-spatial/mapview/actions) + +[![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) [![cran checks](https://badges.cranchecks.info/worst/mapview.svg)](https://cran.r-project.org/web/checks/check_results_mapview.html) ![monthly](https://cranlogs.r-pkg.org/badges/mapview) ![total](https://cranlogs.r-pkg.org/badges/grand-total/mapview) [![CRAN](https://www.r-pkg.org/badges/version/mapview?color=009999)](https://cran.r-project.org/package=mapview) [![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) -[![Coverage Status](https://img.shields.io/codecov/c/github/r-spatial/mapview/develop.svg)](https://app.codecov.io/github/r-spatial/mapview) +[![Codecov test coverage](https://codecov.io/gh/r-spatial/mapview/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/mapview) [![status](https://tinyverse.netlify.com/badge/mapview)](https://CRAN.R-project.org/package=mapview) - + ### Interactive viewing of spatial data in R diff --git a/README.md b/README.md index a27486ee7..4fec8d926 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,16 @@ # mapview -[![tic](https://github.com/r-spatial/mapview/workflows/tic/badge.svg?branch=master)](https://github.com/r-spatial/mapview/actions) + +[![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) [![cran checks](https://badges.cranchecks.info/worst/mapview.svg)](https://cran.r-project.org/web/checks/check_results_mapview.html) ![monthly](https://cranlogs.r-pkg.org/badges/mapview) ![total](https://cranlogs.r-pkg.org/badges/grand-total/mapview) [![CRAN](https://www.r-pkg.org/badges/version/mapview?color=009999)](https://cran.r-project.org/package=mapview) [![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) -[![Coverage -Status](https://img.shields.io/codecov/c/github/r-spatial/mapview/develop.svg)](https://app.codecov.io/github/r-spatial/mapview) +[![Codecov test +coverage](https://codecov.io/gh/r-spatial/mapview/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/mapview) [![status](https://tinyverse.netlify.com/badge/mapview)](https://CRAN.R-project.org/package=mapview) diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 000000000..e59d2d141 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://r-spatial.github.io/mapview/ +template: + bootstrap: 5 + diff --git a/data/breweries.rda b/data/breweries.rda index 57e48e8d3..9820b0780 100644 Binary files a/data/breweries.rda and b/data/breweries.rda differ diff --git a/data/franconia.rda b/data/franconia.rda index db7e1e10c..2ed983d70 100644 Binary files a/data/franconia.rda and b/data/franconia.rda differ diff --git a/data/trails.rda b/data/trails.rda index e56a795bd..46a7d5d36 100644 Binary files a/data/trails.rda and b/data/trails.rda differ diff --git a/man/breweries.Rd b/man/breweries.Rd index 5037b7f05..a3ad95bb2 100644 --- a/man/breweries.Rd +++ b/man/breweries.Rd @@ -7,6 +7,9 @@ \format{ \code{sf feature collection POINT} } +\usage{ +breweries +} \description{ Selected breweries in Franconia } @@ -18,5 +21,6 @@ University of Marburg for a seminar called and partly consists of breweries downloaded from \url{https://www.bierwandern.de/inhalt/brauereiliste.html} with the kind permission of Rainer Kastl. Note that use of these data is restricted to non-commercial use -and that they are explixitly excluded from the GPL lincense that mapview is licensed under. +and that they are explicitly excluded from the GPL license that mapview is licensed under. } +\keyword{datasets} diff --git a/man/franconia.Rd b/man/franconia.Rd index d65a2036b..11ca69304 100644 --- a/man/franconia.Rd +++ b/man/franconia.Rd @@ -10,6 +10,9 @@ \source{ \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts} } +\usage{ +franconia +} \description{ Administrative district borders of Franconia } @@ -18,3 +21,4 @@ The NUTS_2013_01M_SH.zip archive was downloaded on 23/03/2017 from \url{https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts}. \url{https://gist.github.com/tim-salabim/2845fa90813fa25c18cf83f9b88cbde0} } +\keyword{datasets} diff --git a/man/knit_print.mapview.Rd b/man/knit_print.mapview.Rd index a66e4c87f..3150167a7 100644 --- a/man/knit_print.mapview.Rd +++ b/man/knit_print.mapview.Rd @@ -4,7 +4,7 @@ \alias{knit_print.mapview} \title{Print functions for mapview objects used in knitr} \usage{ -knit_print.mapview(x, ...) +\method{knit_print}{mapview}(x, ...) } \arguments{ \item{x}{A mapview object} diff --git a/man/mapView.Rd b/man/mapView.Rd index fdc1e3c93..51017ebd6 100644 --- a/man/mapView.Rd +++ b/man/mapView.Rd @@ -474,9 +474,9 @@ \arguments{ \item{x}{a \code{Raster*} or \code{Spatial*} or \code{Satellite} or \code{sf} or \code{stars} object or a list of any combination of those. Furthermore, - this can also be a \code{data.frame}, a \code{numeric vector} or a +this can also be a \code{data.frame}, a \code{numeric vector} or a \code{character string} pointing to a tile image folder or file on disk. - If missing, a blank map will be drawn. A value of NULL will return NULL.} +If missing, a blank map will be drawn. A value of NULL will return NULL.} \item{map}{an optional existing map to be updated/added to.} @@ -484,16 +484,16 @@ If maxpixels < \code{ncell(x)}, sampleRegular is used before plotting.} \item{col.regions}{color (palette) pixels. -See \code{\link{levelplot}} for details.} +See \code{\link[lattice]{levelplot}} for details.} \item{at}{the breakpoints used for the visualisation. -See \code{\link{levelplot}} for details.} +See \code{\link[lattice]{levelplot}} for details.} \item{na.color}{color for missing values} \item{use.layer.names}{should layer names of the Raster* object be used?} -\item{map.types}{character spcifications for the base maps. +\item{map.types}{character specifications for the base maps. see \url{https://leaflet-extras.github.io/leaflet-providers/preview/} for available options.} @@ -532,7 +532,7 @@ which is appropriate for continuous variables. The other option, 'ngb' layer is of class \code{factor} in which case "ngb" is used.} \item{label}{For vector data (sf/sp) a character vector of labels to be -shown on mouseover. See \code{\link{addControl}} for details. For raster +shown on mouseover. See \code{\link[leaflet]{addControl}} for details. For raster data (Raster*/stars) a logical indicating whether to add image query.} \item{query.type}{for raster methods only. Whether to show raster value query @@ -542,7 +542,7 @@ on \code{'mousemove'} or \code{'click'}. Ignored if \code{label = FALSE}.} by raster value query. Ignored if \code{label = FALSE}.} \item{query.position}{for raster methods only. The position of the raster -value query info box. See \code{position} argument of \code{\link{addLegend}} +value query info box. See \code{position} argument of \code{\link[leaflet]{addLegend}} for possible values. Ignored if \code{label = FALSE}.} \item{query.prefix}{for raster methods only. a character string to be shown @@ -555,19 +555,19 @@ Use \code{mapviewOptions(viewer.suppress = TRUE/FALSE)} instead.} See Details for more information on what exactly it does for different raster types.} \item{...}{additional arguments passed on to respective functions. -See \code{\link{addRasterImage}}, \code{\link{addCircles}}, -\code{\link{addPolygons}}, \code{\link{addPolylines}} for details. +See \code{\link[leaflet]{addRasterImage}}, \code{\link[leaflet]{addCircles}}, +\code{\link[leaflet]{addPolygons}}, \code{\link[leaflet]{addPolylines}} for details. Furthermore, you can pass hidden arguments to some methods. See Details for a list of supported hidden arguments.} \item{band}{for stars layers, the band number to be plotted.} \item{pane}{name of the map pane in which to render features. See -\code{\link{addMapPane}} for details. Currently only supported for vector layers. - Ignored if \code{canvas = TRUE}. The default \code{"auto"} will create different panes - for points, lines and polygons such that points overlay lines overlay polygons. - Set to \code{NULL} to get default leaflet behaviour where allfeatures - are rendered in the same pane and layer order is determined automatically/sequentially.} +\code{\link[leaflet]{addMapPane}} for details. Currently only supported for vector layers. +Ignored if \code{canvas = TRUE}. The default \code{"auto"} will create different panes +for points, lines and polygons such that points overlay lines overlay polygons. +Set to \code{NULL} to get default leaflet behaviour where allfeatures +are rendered in the same pane and layer order is determined automatically/sequentially.} \item{canvas}{whether to use canvas rendering rather than svg. May help performance with larger data. See \url{https://leafletjs.com/index.html#canvas} @@ -593,7 +593,7 @@ of the column(s) to be used for defining the size of circles} \item{popup}{either \code{logical}, \code{character vector} or a \code{list} of HTML strings with the popup contents, usually created from -\code{\link[leafpop]{popupTable}}. See \code{\link{addControl}} for details. +\code{\link[leafpop]{popupTable}}. See \code{\link[leaflet]{addControl}} for details. If \code{FALSE} or \code{NULL} no popups will be created, if \code{TRUE} a table with all feature attributes/columns will be created. If a \code{character vector} of column names, the table will only show the @@ -601,7 +601,7 @@ respective column entries.} \item{highlight}{either \code{FALSE}, \code{NULL} or a list of styling options for feature highlighting on mouse hover. -See \code{\link{highlightOptions}} for details.} +See \code{\link[leaflet]{highlightOptions}} for details.} \item{maxpoints}{the maximum number of points making up the geometry. In case of lines and polygons this refers to the number of vertices. See @@ -623,11 +623,11 @@ data.frame method.} \item{ycol}{the column to be mapped to the y-axis. Only relevant for the data.frame method.} -\item{aspect}{the ratio of x/y axis corrdinates to adjust the plotting +\item{aspect}{the ratio of x/y axis coordinates to adjust the plotting space to fit the screen. Only relevant for the data.frame method.} \item{crs}{an optional crs specification for the provided data to enable -rendering on a basemap. See argument description in \code{\link{st_sf}} +rendering on a basemap. See argument description in \code{\link[sf]{st_sf}} for details.} } \description{ @@ -647,24 +647,24 @@ dimensions Z and M will be stripped to ensure smooth rendering even though the popup will potentially still say something like "POLYGON Z". \code{maxpoints} is taken to determine when to switch rendering from svg - to canvas overlay for perfomance. The threshold calculation is done as follows: \cr - if the number of points (in case of point data) or vertices (in case of - polygon or line data) > \code{maxpoints} then render using special render - function. Within this render function we approximate the complexity of - features by \cr +to canvas overlay for performance. The threshold calculation is done as follows: \cr +if the number of points (in case of point data) or vertices (in case of +polygon or line data) > \code{maxpoints} then render using special render +function. Within this render function we approximate the complexity of +features by \cr \cr \code{maxFeatures <- maxfeatures / (npts(data) / length(data))} \cr \cr - where \code{npts} determines the number of points/vertices and \code{length} - the number of features (points, lines or polygons). When the number of - features in the current view window is larger than \code{maxFeatures} then - features are rendered on the canvas, otherwise they are rendered as svg objects - and fully queriable.\cr - \cr - \code{hide} if TRUE, will hide the layer in case of a single RasterLayer - and all but the first layer in case of a multilayer RasterStackBrick. - If a vector of layer names or indices is supplied, these will be hidden - (only applicable for multi-layer RasterStackBricks). +where \code{npts} determines the number of points/vertices and \code{length} +the number of features (points, lines or polygons). When the number of +features in the current view window is larger than \code{maxFeatures} then +features are rendered on the canvas, otherwise they are rendered as svg objects +and fully queriable.\cr +\cr +\code{hide} if TRUE, will hide the layer in case of a single RasterLayer +and all but the first layer in case of a multilayer RasterStackBrick. +If a vector of layer names or indices is supplied, these will be hidden +(only applicable for multi-layer RasterStackBricks). } \section{Methods (by class)}{ \itemize{ @@ -674,15 +674,15 @@ the popup will potentially still say something like "POLYGON Z". \item \code{mapView(SpatRaster)}: \code{SpatRaster} -\item \code{mapView(RasterStackBrick)}: \code{\link{stack}} / \code{\link{brick}} +\item \code{mapView(RasterStackBrick)}: \code{\link[raster]{stack}} / \code{\link[raster]{brick}} -\item \code{mapView(Satellite)}: \code{\link{satellite}} +\item \code{mapView(Satellite)}: \code{\link[satellite]{satellite}} \item \code{mapView(sf)}: \code{sf} \item \code{mapView(SpatVector)}: \code{SpatVector} -\item \code{mapView(sfc)}: \code{\link{st_sfc}} +\item \code{mapView(sfc)}: \code{\link[sf]{st_sfc}} \item \code{mapView(character)}: \code{\link{character}} @@ -690,15 +690,15 @@ the popup will potentially still say something like "POLYGON Z". \item \code{mapView(data.frame)}: \code{\link{data.frame}} -\item \code{mapView(XY)}: \code{\link{st_sfc}} +\item \code{mapView(XY)}: \code{\link[sf]{st_sfc}} -\item \code{mapView(XYZ)}: \code{\link{st_sfc}} +\item \code{mapView(XYZ)}: \code{\link[sf]{st_sfc}} -\item \code{mapView(XYM)}: \code{\link{st_sfc}} +\item \code{mapView(XYM)}: \code{\link[sf]{st_sfc}} -\item \code{mapView(XYZM)}: \code{\link{st_sfc}} +\item \code{mapView(XYZM)}: \code{\link[sf]{st_sfc}} -\item \code{mapView(bbox)}: \code{\link{st_bbox}} +\item \code{mapView(bbox)}: \code{\link[sf]{st_bbox}} \item \code{mapView(missing)}: initiate a map without an object @@ -708,21 +708,21 @@ the popup will potentially still say something like "POLYGON Z". \item \code{mapview(ANY)}: alias for ease of typing -\item \code{mapView(SpatialPixelsDataFrame)}: \code{\link{SpatialPixelsDataFrame}} +\item \code{mapView(SpatialPixelsDataFrame)}: \code{\link[sp]{SpatialPixelsDataFrame}} -\item \code{mapView(SpatialGridDataFrame)}: \code{\link{SpatialGridDataFrame}} +\item \code{mapView(SpatialGridDataFrame)}: \code{\link[sp]{SpatialGridDataFrame}} -\item \code{mapView(SpatialPointsDataFrame)}: \code{\link{SpatialPointsDataFrame}} +\item \code{mapView(SpatialPointsDataFrame)}: \code{\link[sp]{SpatialPointsDataFrame}} -\item \code{mapView(SpatialPoints)}: \code{\link{SpatialPoints}} +\item \code{mapView(SpatialPoints)}: \code{\link[sp]{SpatialPoints}} -\item \code{mapView(SpatialPolygonsDataFrame)}: \code{\link{SpatialPolygonsDataFrame}} +\item \code{mapView(SpatialPolygonsDataFrame)}: \code{\link[sp]{SpatialPolygonsDataFrame}} -\item \code{mapView(SpatialPolygons)}: \code{\link{SpatialPolygons}} +\item \code{mapView(SpatialPolygons)}: \code{\link[sp]{SpatialPolygons}} -\item \code{mapView(SpatialLinesDataFrame)}: \code{\link{SpatialLinesDataFrame}} +\item \code{mapView(SpatialLinesDataFrame)}: \code{\link[sp]{SpatialLinesDataFrame}} -\item \code{mapView(SpatialLines)}: \code{\link{SpatialLines}} +\item \code{mapView(SpatialLines)}: \code{\link[sp]{SpatialLines}} }} \examples{ diff --git a/man/mapshot.Rd b/man/mapshot.Rd index 02d1bc8f9..52e7c8dad 100644 --- a/man/mapshot.Rd +++ b/man/mapshot.Rd @@ -33,8 +33,8 @@ a temporary index file will be created.} \item{remove_controls}{\code{character} vector of control buttons to be removed from the map when saving to file. Any combination of -"zoomControl", "layersControl", "homeButton", "scaleBar", "drawToolbar", -"easyButton". If set to \code{NULL} nothing will be removed. Ignored if \code{x} +\code{"zoomControl"}, \code{"layersControl"}, \code{"homeButton"}, \code{"scaleBar"}, \code{"drawToolbar"}, +\code{"easyButton"}. If set to \code{NULL} nothing will be removed. Ignored if \code{x} is not a mapview or leaflet map.} \item{...}{Further arguments passed on to \code{\link[htmlwidgets]{saveWidget}} diff --git a/man/mapview-defunct.Rd b/man/mapview-defunct.Rd index 7652169a4..a03019d03 100644 --- a/man/mapview-defunct.Rd +++ b/man/mapview-defunct.Rd @@ -9,57 +9,57 @@ See below for information on which package they have been moved to. } \details{ \itemize{ - \item \code{cubeview}: This function is defunct, and has been - migrated to package 'cubeview'. - \item \code{cubeView}: This function is defunct, and has been - migrated to package 'cubeview'. - \item \code{cubeViewOutput}: This function is defunct, and has been - migrated to package 'cubeview'. - \item \code{renderCubeView}: This function is defunct, and has been - migrated to package 'cubeview'. - \item \code{slideview}: This function is defunct, and has been - migrated to package 'slideview'. - \item \code{slideView}: This function is defunct, and has been - migrated to package 'slideview'. - \item \code{slideViewOutput}: This function is defunct, and has been - migrated to package 'slideview'. - \item \code{renderslideView}: This function is defunct, and has been - migrated to package 'slideview'. - \item \code{latticeView}: This function is defunct, and has been - migrated to package 'leafsync'. - \item \code{sync}: This function is defunct, and has been - migrated to package 'leafsync'. - \item \code{plainview}: This function is defunct, and has been - migrated to package 'plainview'. - \item \code{plainView}: This function is defunct, and has been - migrated to package 'plainview'. - \item \code{popupTable}: This function is defunct, and has been - migrated to package 'leafpop'. - \item \code{popupImage}: This function is defunct, and has been - migrated to package 'leafpop'. - \item \code{popupGraph}: This function is defunct, and has been - migrated to package 'leafpop'. - \item \code{addFeatures}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{garnishMap}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addHomeButton}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{removeHomeButton}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addImageQuery}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addLogo}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addMouseCoordinates}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{removeMouseCoordinates}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addStaticLabels}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addExtent}: This function is defunct, and has been - migrated to package 'leafem'. - \item \code{addStarsImage}: This function is defunct, and has been - migrated to package 'leafem'. +\item \code{cubeview}: This function is defunct, and has been +migrated to package 'cubeview'. +\item \code{cubeView}: This function is defunct, and has been +migrated to package 'cubeview'. +\item \code{cubeViewOutput}: This function is defunct, and has been +migrated to package 'cubeview'. +\item \code{renderCubeView}: This function is defunct, and has been +migrated to package 'cubeview'. +\item \code{slideview}: This function is defunct, and has been +migrated to package 'slideview'. +\item \code{slideView}: This function is defunct, and has been +migrated to package 'slideview'. +\item \code{slideViewOutput}: This function is defunct, and has been +migrated to package 'slideview'. +\item \code{renderslideView}: This function is defunct, and has been +migrated to package 'slideview'. +\item \code{latticeView}: This function is defunct, and has been +migrated to package 'leafsync'. +\item \code{sync}: This function is defunct, and has been +migrated to package 'leafsync'. +\item \code{plainview}: This function is defunct, and has been +migrated to package 'plainview'. +\item \code{plainView}: This function is defunct, and has been +migrated to package 'plainview'. +\item \code{popupTable}: This function is defunct, and has been +migrated to package 'leafpop'. +\item \code{popupImage}: This function is defunct, and has been +migrated to package 'leafpop'. +\item \code{popupGraph}: This function is defunct, and has been +migrated to package 'leafpop'. +\item \code{addFeatures}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{garnishMap}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addHomeButton}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{removeHomeButton}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addImageQuery}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addLogo}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addMouseCoordinates}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{removeMouseCoordinates}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addStaticLabels}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addExtent}: This function is defunct, and has been +migrated to package 'leafem'. +\item \code{addStarsImage}: This function is defunct, and has been +migrated to package 'leafem'. } } diff --git a/man/mapview-package.Rd b/man/mapview-package.Rd index 88fb14fe4..a48867c13 100644 --- a/man/mapview-package.Rd +++ b/man/mapview-package.Rd @@ -3,9 +3,9 @@ \docType{package} \name{mapview-package} \alias{mapview-package} -\title{Interactive viewing of spatial objects in R} +\title{mapview: Interactive Viewing of Spatial Data in R} \description{ -Interactive viewing of spatial objects in R +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. } \details{ The package provides functionality to view spatial objects interactively. @@ -23,10 +23,27 @@ Useful links: } \author{ -Tim Appelhans, Florian Detsch, Chris Reudenbach, -Stephan Woellauer, Spaska Forteva, Thomas Nauss, -Environmental Informatics Marburg \cr -\cr -\emph{Maintainer:} Tim Appelhans \email{tim.appelhans@gmail.com} +\strong{Maintainer}: Tim Appelhans \email{tim.appelhans@gmail.com} + +Authors: +\itemize{ + \item Florian Detsch \email{fdetsch@web.de} + \item Christoph Reudenbach \email{reudenbach@geo.uni-marburg.de} + \item Stefan Woellauer \email{stephan.woellauer@geo.uni-marburg.de} +} + +Other contributors: +\itemize{ + \item Spaska Forteva \email{spaska.forteva@geo.uni-marburg.de} [contributor] + \item Thomas Nauss \email{nauss@staff.uni-marburg.de} [contributor] + \item Edzer Pebesma [contributor] + \item Kenton Russell [contributor] + \item Michael Sumner [contributor] + \item Jochen Darley \email{Debugger@jedimasters.de} [contributor] + \item Pierre Roudier [contributor] + \item Patrick Schratz [contributor] + \item Environmental Informatics Marburg [contributor] + \item Lorenzo Busetto [contributor] +} + } -\keyword{package} diff --git a/man/mapviewColors.Rd b/man/mapviewColors.Rd index d2f11249e..a24546057 100644 --- a/man/mapviewColors.Rd +++ b/man/mapviewColors.Rd @@ -31,7 +31,7 @@ specified in at} \item{na.color}{the color for NA values.} -\item{...}{additional arguments passed on to \code{\link{level.colors}}} +\item{...}{additional arguments passed on to \code{\link[lattice]{level.colors}}} \item{name}{Name of the color palette to be used. One of "mapviewVectorColors" (default), "mapviewRasterColors", @@ -43,7 +43,7 @@ mapview version of leaflet::color* functions Color palettes for mapview } \seealso{ -\code{\link{level.colors}} +\code{\link[lattice]{level.colors}} \code{\link{colorRampPalette}} } diff --git a/man/mapviewOptions.Rd b/man/mapviewOptions.Rd index 9a6ba909d..9d3b887ea 100644 --- a/man/mapviewOptions.Rd +++ b/man/mapviewOptions.Rd @@ -78,10 +78,10 @@ behaviour. Set this to TRUE if you want to see these printed to the console.} \item{legend.opacity}{opacity of the legend.} \item{legend.pos}{Where should the legend be placed? -One of "topleft", "topright", "bottomleft", "bottomright".} +One of \code{"topleft"}, \code{"topright"}, \code{"bottomleft"}, \code{"bottomright"}.} \item{layers.control.pos}{character. Where should the layer control be -placed? One of "topleft", "topright", "bottomleft", "bottomright".} +placed? One of \code{"topleft"}, \code{"topright"}, \code{"bottomleft"}, \code{"bottomright"}.} \item{leafletWidth, leafletHeight}{height and width of the htmlwidget in px.} @@ -91,15 +91,15 @@ or the RStudio viewer (\code{FALSE}).} \item{homebutton}{logical, whether to add a zoom-to-layer button to the map.} \item{homebutton.pos}{character. Where should the homebutton(s) be -placed? One of "topleft", "topright", "bottomleft", "bottomright".} +placed? One of \code{"topleft"}, \code{"topright"}, \code{"bottomleft"}, \code{"bottomright"}.} \item{native.crs}{logical whether to reproject to web map coordinate -reference system (web mercator - epsg:3857) or render using native CRS of +reference system (web Mercator - epsg:3857) or render using native CRS of the supplied data (can also be NA). Default is FALSE which will render in -web mercator. If set to TRUE now background maps will be drawn (but rendering +web Mercator. If set to TRUE now background maps will be drawn (but rendering may be much quicker as no reprojecting is necessary).} -\item{raster.size}{numeric. see the maxBytes argument in \code{\link{addRasterImage}}} +\item{raster.size}{numeric. see the maxBytes argument in \code{\link[leaflet]{addRasterImage}}} \item{mapview.maxpixels}{numeric. The maximum amount of pixels allowed for Raster* objects to be rendered with \code{mapview}. Defaults to 500000. @@ -128,7 +128,7 @@ on \code{'mousemove'} or \code{'click'}. Ignored if \code{label = FALSE}.} by raster value query. Ignored if \code{label = FALSE}.} \item{query.position}{for raster methods only. The position of the raster -value query info box. See \code{position} argument of \code{\link{addLegend}} +value query info box. See \code{position} argument of \code{\link[leaflet]{addLegend}} for possible values. Ignored if \code{label = FALSE}.} \item{query.prefix}{for raster methods only. a character string to be shown @@ -153,10 +153,10 @@ This means that standard functionality is reduced. For example adding layers via "+" is not possible anymore.} \item{pane}{name of the map pane in which to render features. See -\code{\link{addMapPane}} for details. Currently only supported for vector layers. +\code{\link[leaflet]{addMapPane}} for details. Currently only supported for vector layers. Ignored if \code{canvas = TRUE}. The default \code{"auto"} will create different panes for points, lines and polygons such that points overlay lines overlay polygons. -Set to \code{NULL} to get default leaflet behaviour where allfeatures +Set to \code{NULL} to get default leaflet behaviour where all features are rendered in the same pane and layer order is determined automatically/sequentially.} \item{cex}{numeric or attribute name(s) or column number(s) in attribute table @@ -172,19 +172,19 @@ of the column(s) to be used for defining the size of circles.} render changes to the list of spatial data in that environment. See \link{mapviewWatcher} for details.} -\item{fgb}{if set to \code{TRUE} mapview will not use 'clasical' leaflet/htmlwidgets +\item{fgb}{if set to \code{TRUE} mapview will not use 'classical' leaflet/htmlwidgets rendering (which embeds data directly in the html) but leverage the speed of a file format called flatgeobuf (hence, fgb). This has the added benefit that data is being streamed onto the map, which makes for a pleasant user experience. -It should also help to visualise larger data sets due to a reduced memeory footprint. +It should also help to visualise larger data sets due to a reduced memory footprint. A note of warning, data will be attached to the html via a call which means that the html is not selfcontained anymore (so it cannot be used without an accompanying folder).} \item{georaster}{whether to use \code{\link[leafem]{addGeoRaster}} instead of \code{\link[leaflet]{addRasterImage}}. If set to \code{TRUE} raster image visualisation - will be more performant for large raster data, but given the nearest neighbor - resampling results may be slightly distorted.} +will be more performant for large raster data, but given the nearest neighbor +resampling results may be slightly distorted.} \item{param}{character. parameter(s) to be queried.} } @@ -194,7 +194,7 @@ If no arguments are provided the options are printed. } \description{ To permanently set any of these options, you can add them to -/etc/Rprofile.site>. For example, +\if{html}{\out{}}/etc/Rprofile.site>. For example, to change the default number of pixels to be visualised for Raster* objects, add a line like this: options(mapviewMaxPixels = 700000) to that file. } @@ -216,7 +216,7 @@ mapviewOptions() } \seealso{ -\code{\link{rasterOptions}}, \code{\link{options}} +\code{\link[raster]{rasterOptions}}, \code{\link{options}} } \author{ Tim Appelhans diff --git a/man/mapviewOutput.Rd b/man/mapviewOutput.Rd index 544c3f477..4abd27dd7 100644 --- a/man/mapviewOutput.Rd +++ b/man/mapviewOutput.Rd @@ -10,7 +10,7 @@ mapviewOutput(outputId, width = "100\%", height = 400) \item{outputId}{Output variable to read from} \item{width, height}{the width and height of the map -(see \code{\link{shinyWidgetOutput}})} +(see \code{\link[htmlwidgets]{shinyWidgetOutput}})} } \description{ Create a mapview UI element for use with shiny diff --git a/man/mapviewWatcher.Rd b/man/mapviewWatcher.Rd index 61eb3b279..35beb796c 100644 --- a/man/mapviewWatcher.Rd +++ b/man/mapviewWatcher.Rd @@ -13,31 +13,31 @@ startWatching(env = .GlobalEnv, ...) stopWatching(env = .GlobalEnv, ...) } \arguments{ -\item{env}{the environemnt that is being watched (default is \code{.GlobalEnv}).} +\item{env}{the environment that is being watched (default is \code{.GlobalEnv}).} \item{...}{currently not used.} } \description{ -Use these functions to enable automatic vieweing of all spatial objects - currently available in \code{env}. \code{mapviewWatcher} uses - \link[later]{later} to set up a watcher function that continuously monitors - \code{env} for spatial objects and refreshes the viewer/browser in case - the list of spatial objects changes. - \cr - \cr - \code{startWatching} and \code{stopWatching} are convenience functions to - start and stop watching, respectively. +Use these functions to enable automatic viewing of all spatial objects +currently available in \code{env}. \code{mapviewWatcher} uses +\link[later]{later} to set up a watcher function that continuously monitors +\code{env} for spatial objects and refreshes the viewer/browser in case +the list of spatial objects changes. +\cr +\cr +\code{startWatching} and \code{stopWatching} are convenience functions to +start and stop watching, respectively. } \details{ \code{mapviewWatcher} uses \code{\link{identical}} and hence - will redraw even if e.g. the attributes of a spatial object are changed only - slightly. By default \code{mapviewWatcher} watches the \code{.GlobalEnv} but - this can be changed to another environment. Whether watching is turned on is - controlled by \code{mapviewGetOption("watch")}. In order to enable watching it - needs to be set to \code{mapviewOptions(watch = TRUE)} - (default is \code{FALSE}) and the watcher needs to be initiated by calling - \code{mapviewWatcher()} once. To switch watching off it is sufficient to set - \code{mapviewOptions(watch = FALSE)}. +will redraw even if e.g. the attributes of a spatial object are changed only +slightly. By default \code{mapviewWatcher} watches the \code{.GlobalEnv} but +this can be changed to another environment. Whether watching is turned on is +controlled by \code{mapviewGetOption("watch")}. In order to enable watching it +needs to be set to \code{mapviewOptions(watch = TRUE)} +(default is \code{FALSE}) and the watcher needs to be initiated by calling +\code{mapviewWatcher()} once. To switch watching off it is sufficient to set +\code{mapviewOptions(watch = FALSE)}. } \section{Functions}{ \itemize{ diff --git a/man/ops.Rd b/man/ops.Rd index 506b6ea42..13b0143a3 100644 --- a/man/ops.Rd +++ b/man/ops.Rd @@ -36,7 +36,7 @@ mapview + data adds spatial data (raster*, sf*, sp*) to a mapview map mapview + NULL returns the LHS map -[...] +\link{...} mapview | mapview provides a slider in the middle to compare two maps. diff --git a/man/removeMapJunk.Rd b/man/removeMapJunk.Rd index dca2f3e8b..60179e443 100644 --- a/man/removeMapJunk.Rd +++ b/man/removeMapJunk.Rd @@ -20,12 +20,12 @@ Delete elements from a map. Currently supports removal of \itemize{ - \item "zoomControl" - \item "layersControl" - \item "homeButton" - \item "scaleBar" - \item "drawToolbar" - \item "easyButton" +\item "zoomControl" +\item "layersControl" +\item "homeButton" +\item "scaleBar" +\item "drawToolbar" +\item "easyButton" } This is mainly useful when taking a static screenshot of a map. diff --git a/man/renderMapview.Rd b/man/renderMapview.Rd index 619ade036..ca6d12f5a 100644 --- a/man/renderMapview.Rd +++ b/man/renderMapview.Rd @@ -11,7 +11,7 @@ renderMapview(expr, env = parent.frame(), quoted = FALSE) \item{env}{The environment in which to evaluate expr} -\item{quoted}{Is expr a quoted expression (with quote())? +\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This is useful if you want to save an expression in a variable} } \description{ diff --git a/man/trails.Rd b/man/trails.Rd index 18be08b0c..a37bc0fa4 100644 --- a/man/trails.Rd +++ b/man/trails.Rd @@ -8,9 +8,12 @@ \code{sf feature collection MULTILINESTRING} } \source{ -Datenquelle: Bayerische Vermessungsverwaltung - www.geodaten.bayern.de +Datenquelle: Bayerische Vermessungsverwaltung - \code{www.geodaten.bayern.de} \url{https://www.ldbv.bayern.de/produkte/weitere/opendata.html} } +\usage{ +trails +} \description{ Selected hiking trails in Franconia } @@ -20,3 +23,4 @@ These hiking trails were downloaded on 06/04/2017 from These data are published by the owner under Creative Commons Namensnennung 3.0 Deutschland, see \url{https://creativecommons.org/licenses/by/3.0/de/} for details. } +\keyword{datasets} diff --git a/man/viewExtent.Rd b/man/viewExtent.Rd index 841548eef..36328e871 100644 --- a/man/viewExtent.Rd +++ b/man/viewExtent.Rd @@ -21,7 +21,7 @@ viewExtent( standard background layers are created.} \item{popup}{a \code{list} of HTML strings with the popup contents, usually -created from \code{\link{popupTable}}. See \code{\link{addControl}} for +created from \code{\link[leafpop]{popupTable}}. See \code{\link[leaflet]{addControl}} for details.} \item{layer.name}{the name of the layer to be shown on the map.} @@ -29,9 +29,44 @@ details.} \item{alpha.regions}{opacity of the fills or the raster layer(s).} \item{label}{a character vector of labels to be shown on mouseover. See -\code{\link{addControl}} for details.} +\code{\link[leaflet]{addControl}} for details.} -\item{...}{additional arguments passed on to \code{\link{addRectangles}}} +\item{...}{ + Arguments passed on to \code{\link[leaflet:map-layers]{leaflet::addRectangles}} + \describe{ + \item{\code{layerId}}{the layer id} + \item{\code{data}}{the data object from which the argument values are derived; by +default, it is the \code{data} object provided to \code{leaflet()} +initially, but can be overridden} + \item{\code{group}}{the name of the group the newly created layers should belong to +(for \code{\link[leaflet]{clearGroup}} and \code{\link[leaflet]{addLayersControl}} purposes). +Human-friendly group names are permitted--they need not be short, +identifier-style names. Any number of layers and even different types of +layers (e.g. markers and polygons) can share the same group name.} + \item{\code{options}}{a list of extra options for tile layers, popups, paths +(circles, rectangles, polygons, ...), or other map elements} + \item{\code{popupOptions}}{A Vector of \code{\link[leaflet]{popupOptions}} to provide popups} + \item{\code{labelOptions}}{A Vector of \code{\link[leaflet]{labelOptions}} to provide label +options for each label. Default \code{NULL}} + \item{\code{stroke}}{whether to draw stroke along the path (e.g. the borders of +polygons or circles)} + \item{\code{color}}{stroke color} + \item{\code{weight}}{stroke width in pixels} + \item{\code{opacity}}{stroke opacity (or layer opacity for tile layers)} + \item{\code{fill}}{whether to fill the path with color (e.g. filling on polygons or +circles)} + \item{\code{fillColor}}{fill color} + \item{\code{fillOpacity}}{fill opacity} + \item{\code{dashArray}}{a string that defines the stroke +\href{https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray}{dash +pattern}} + \item{\code{highlightOptions}}{Options for highlighting the shape on mouse over.} + \item{\code{smoothFactor}}{how much to simplify the polyline on each zoom level +(more means better performance and less accurate representation)} + \item{\code{noClip}}{whether to disable polyline clipping} + \item{\code{lng1,lat1,lng2,lat2}}{latitudes and longitudes of the south-west and +north-east corners of rectangles} + }} } \description{ This function produces an interactive view of the extent/bbox diff --git a/man/viewRGB.Rd b/man/viewRGB.Rd index 96a280da6..9c5df8c68 100644 --- a/man/viewRGB.Rd +++ b/man/viewRGB.Rd @@ -61,7 +61,7 @@ different bandwidths in the electromagnetic spectrum) are combined such that they represent the red, green and blue channel. This function can be used to make 'true (or false) color images' from Landsat and other multi-band satellite images. Note, this text is plagiarized, i.e. copied -from \code{\link{plotRGB}}. +from \code{\link[raster:plotRGB]{raster::plotRGB()}}. } \examples{ if (interactive()) { diff --git a/tic.R b/tic.R deleted file mode 100644 index 89cb3ae70..000000000 --- a/tic.R +++ /dev/null @@ -1,8 +0,0 @@ -# installs dependencies, runs R CMD check, runs covr::codecov() -do_package_checks(build_args = "--resave-data") - -if (ci_on_ghactions() && ci_has_env("BUILD_PKGDOWN")) { - # creates pkgdown site and pushes to gh-pages branch - # only for the runner with the "BUILD_PKGDOWN" env var set - do_pkgdown() -} diff --git a/vignettes/articles/mapview_03-options.Rmd b/vignettes/articles/mapview_03-options.Rmd index 2f23cbbfc..6213a8588 100644 --- a/vignettes/articles/mapview_03-options.Rmd +++ b/vignettes/articles/mapview_03-options.Rmd @@ -43,7 +43,7 @@ In detail, these are: * `legend` - whether to plot a legend -> default `FALSE` * `legend.pos` - where to position the legend if shown -> default `topright` * `layers.control.pos` - where to position the layers control on the map -> default `topleft` -* `leafletWidth`, `leafletHeight` - the width and height of the map widget -> defaul `NULL` which means that the browser will be filled if possible +* `leafletWidth`, `leafletHeight` - the width and height of the map widget -> default `NULL` which means that the browser will be filled if possible ------ diff --git a/vignettes/articles/mapview_06-add.Rmd b/vignettes/articles/mapview_06-add.Rmd index cd9e65939..98eeb2360 100644 --- a/vignettes/articles/mapview_06-add.Rmd +++ b/vignettes/articles/mapview_06-add.Rmd @@ -20,7 +20,7 @@ Package **leafem** provides a few extra `add*` functions for use with leaflet (a - `addMouseCoordinates` - add a box with mouse position, projection information and zoom level information - `addLogo` - add images to maps - `addHomeButton` - add zoom-to button to a map -- `addFeatures` - add features to a map, regardless of features type unresposnive +- `addFeatures` - add features to a map, regardless of features type unresponsive Here are some examples: @@ -84,7 +84,7 @@ leaflet() %>% ## addFeatures -is a type agnostic `add*` function which will call the approprate `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. +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. ```{r addpols} library(leafem) diff --git a/vignettes/articles/mapview_07-pipe.Rmd b/vignettes/articles/mapview_07-pipe.Rmd index 7216dfe49..adca94b87 100644 --- a/vignettes/articles/mapview_07-pipe.Rmd +++ b/vignettes/articles/mapview_07-pipe.Rmd @@ -13,7 +13,6 @@ vignette: > ```{r setup, echo=FALSE, message=FALSE} knitr::opts_chunk$set(fig.width = 8.83, message = FALSE, warning = FALSE) -remotes::install_github("hrbrmstr/albersusa") ``` **mapview** can be used in piped expressions using `%>%`, most likely at the very end of it... @@ -27,9 +26,10 @@ library(mapview) library(poorman) library(leaflet) library(sf) -# GitHub: hrbrmstr/albersusa -library(albersusa) +``` + +```{r pipe1a-3} franconia %>% st_union %>% plot @@ -110,20 +110,3 @@ franconia %>% ```
- -## using `native.crs` for a USA composite map - -```{r pipe8a} -albersusa::usa_composite("laea") %>% - mapview(native.crs = TRUE, zcol = "pop_2014", legend = TRUE) -``` - -
- -## without `native.crs` - -```{r pipe8b} -albersusa::usa_composite("laea") %>% - mapview(zcol = "pop_2014", legend = TRUE) -``` -