Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mapviewWatcher

Start and/or stop automagic mapviewing of spatial objects in your workspace.


Description

Use these functions to enable automatic vieweing of all spatial objects currently available in env. mapviewWatcher uses later to set up a watcher function that continuously monitors env for spatial objects and refreshes the viewer/browser in case the list of spatial objects changes.

startWatching and stopWatching are convenience functions to start and stop watching, respectively.

Usage

mapviewWatcher(env = .GlobalEnv, ...)

startWatching(env = .GlobalEnv, ...)

stopWatching(env = .GlobalEnv, ...)

Arguments

env

the environemnt that is being watched (default is .GlobalEnv).

...

currently not used.

Details

mapviewWatcher uses identical and hence will redraw even if e.g. the attributes of a spatial object are changed only slightly. By default mapviewWatcher watches the .GlobalEnv but this can be changed to another environment. Whether watching is turned on is controlled by mapviewGetOption("watch"). In order to enable watching it needs to be set to mapviewOptions(watch = TRUE) (default is FALSE) and the watcher needs to be initiated by calling mapviewWatcher() once. To switch watching off it is sufficient to set mapviewOptions(watch = FALSE).

Functions

  • startWatching: start watching

  • stopWatching: stop watching

Examples

if (interactive()) {
    library(mapview)

    ## start the watcher
    mapview::startWatching()

    ## load some data and watch the automatic visualisation
    fran = mapview::franconia
    brew = mapview::breweries

    ## stop the watcher
    mapview::stopWatching()

    ## loading or removing things now will not trigger a view update
    rm(brew)
    trls = mapview::trails

    ## re-starting the viewer will re-draw whatever is currently available
    mapview::startWatching()

    ## watcher can also be stopped via mapviewOptions
    mapviewOptions(watch = FALSE)

    rm(trls)

  }

mapview

Interactive Viewing of Spatial Data in R

v2.10.0
GPL (>= 3) | file LICENSE
Authors
Tim Appelhans [cre, aut], Florian Detsch [aut], Christoph Reudenbach [aut], Stefan Woellauer [aut], Spaska Forteva [ctb], Thomas Nauss [ctb], Edzer Pebesma [ctb], Kenton Russell [ctb], Michael Sumner [ctb], Jochen Darley [ctb], Pierre Roudier [ctb], Patrick Schratz [ctb], Environmental Informatics Marburg [ctb], Lorenzo Busetto [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.