Learn R Programming

⚠️There's a newer version (0.2.3) of this package.Take me there.

leafem - leaflet extensions for mapview

leafem provides extensions for package leaflet many of which are used by package mapview. The intention of this package is to enhance leaflet functionality to provide a more GIS-like feeling when plotting spatial data interactively.

Installation

You can install the released version of leafem from CRAN with:

install.packages("leafem")

Extensions

addFeatures

library(leaflet)

leaflet() %>% addProviderTiles("OpenStreetMap") %>% addFeatures(data = breweries91)

addMouseCoordinates

leaflet() %>%
  addProviderTiles("OpenStreetMap") %>%
  addMouseCoordinates()

garnishMap

library(leaflet)

m <- leaflet() %>% addProviderTiles("OpenStreetMap")
garnishMap(m, addMouseCoordinates)

addHomeButton

library(leaflet)
library(raster)

m <- leaflet() %>%
  addProviderTiles("OpenStreetMap") %>%
  addCircleMarkers(data = breweries91) %>%
  addHomeButton(extent(breweries91), "breweries91")
m

addImageQuery

library(leaflet)
library(plainview)

leaflet() %>%
  addProviderTiles("OpenStreetMap") %>%
  addRasterImage(poppendorf[[1]], project = TRUE, group = "poppendorf",
                 layerId = "poppendorf") %>%
  addImageQuery(poppendorf[[1]], project = TRUE,
                layerId = "poppendorf") %>%
  addLayersControl(overlayGroups = "poppendorf")

addLogo

img <- "https://www.r-project.org/logo/Rlogo.svg"

leaflet() %>% addTiles() %>% addLogo(img, url = "https://www.r-project.org/logo/")

Code of Conduct

Please note that the ‘leafem’ project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Copy Link

Version

Install

install.packages('leafem')

Monthly Downloads

27,306

Version

0.1.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

July 26th, 2020

Functions in leafem (0.1.3)

addMouseCoordinates

Add mouse coordinate information at top of map.
colorOptions

Color options for addGeoRaster and addGeotiff
addTileFolder

Add raster tiles from a local folder
addStarsImage

Add stars layer to a leaflet map
addStaticLabels

Add static labels to leaflet or mapview objects
addRasterRGB

Add an RGB image as a layer
updateLayersControl

Update the layer controls when adding layers to an existing map.
garnishMap

Garnish/decorate leaflet or mapview maps.
addExtent

Add extent/bbox of spatial objects to a leaflet map
addFgb

Add a flatgeobuf file to leaflet map
addImageQuery

Add image query functionality to leaflet/mapview map.
addGeoRaster

Add stars/raster image to a leaflet map using optimised rendering.
addGeotiff

Add a GeoTIFF file to a leaflet map using optimised rendering.
addFeatures

Type agnositc version of leaflet::add* functions.
addHomeButton

Add a home button / zoom-to-layer button to a map.
addCopyExtent

Copy current view extent to the clipboard
addLocalFile

Add vector data to leaflet map directly from the file system
addLogo

add a local or remote image (png, jpg, gif, bmp, ...) to a leaflet map