https://github.com/r-spatial/leafem
leaflet extensions for mapview
https://github.com/r-spatial/leafem
Last synced: 14 days ago
JSON representation
leaflet extensions for mapview
- Host: GitHub
- URL: https://github.com/r-spatial/leafem
- Owner: r-spatial
- License: other
- Created: 2019-04-15T20:01:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-27T11:17:28.000Z (about 2 months ago)
- Last Synced: 2025-03-31T15:24:53.165Z (18 days ago)
- Language: JavaScript
- Homepage: https://r-spatial.github.io/leafem/
- Size: 18.3 MB
- Stars: 108
- Watchers: 12
- Forks: 30
- Open Issues: 19
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-leaflet - leafem: leaflet extensions for mapview
- jimsghstars - r-spatial/leafem - leaflet extensions for mapview (JavaScript)
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
eval = FALSE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# leafem - leaflet extensions for mapview
[](https://github.com/r-spatial/leafem/actions)
[](https://cran.r-project.org/web/checks/check_results_leafem.html)


[](https://cran.r-project.org/package=leafem)`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](https://CRAN.R-project.org) with:
```{r install}
install.packages("leafem")
```## Extensions
#### addFeatures
```{r features}
library(leaflet)leaflet() %>% addProviderTiles("OpenStreetMap") %>% addFeatures(data = breweries91)
```
#### addMouseCoordinates
```{r mousecoords}
leaflet() %>%
addProviderTiles("OpenStreetMap") %>%
addMouseCoordinates()
```
#### garnishMap
```{r garnish}
library(leaflet)m <- leaflet() %>% addProviderTiles("OpenStreetMap")
garnishMap(m, addMouseCoordinates)
```
#### addHomeButton
```{r home}
library(leaflet)
library(raster)m <- leaflet() %>%
addProviderTiles("OpenStreetMap") %>%
addCircleMarkers(data = breweries91) %>%
addHomeButton(extent(breweries91), "breweries91")
m
```
#### addImageQuery
```{r query}
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
```{r logo}
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](https://github.com/r-spatial/leafem/blob/master/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.