Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-spatial/leafem
leaflet extensions for mapview
https://github.com/r-spatial/leafem
Last synced: 3 months 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T23:17:45.000Z (8 months ago)
- Last Synced: 2024-06-27T12:43:36.984Z (7 months ago)
- Language: JavaScript
- Homepage: https://r-spatial.github.io/leafem/
- Size: 16.1 MB
- Stars: 107
- Watchers: 12
- Forks: 28
- Open Issues: 17
-
Metadata Files:
- Readme: README.Rmd
- 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
[![R-CMD-check](https://github.com/r-spatial/leafem/workflows/R-CMD-check/badge.svg)](https://github.com/r-spatial/leafem/actions)
[![cran checks](https://badges.cranchecks.info/worst/leafem.svg)](https://cran.r-project.org/web/checks/check_results_leafem.html)
![monthly](http://cranlogs.r-pkg.org/badges/leafem)
![total](http://cranlogs.r-pkg.org/badges/grand-total/leafem)
[![CRAN](http://www.r-pkg.org/badges/version/leafem?color=009999)](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)
```![](figures/README-features.png)
#### addMouseCoordinates
```{r mousecoords}
leaflet() %>%
addProviderTiles("OpenStreetMap") %>%
addMouseCoordinates()
```![](figures/README-garnish.png)
#### garnishMap
```{r garnish}
library(leaflet)m <- leaflet() %>% addProviderTiles("OpenStreetMap")
garnishMap(m, addMouseCoordinates)
```![](figures/README-garnish.png)
#### addHomeButton
```{r home}
library(leaflet)
library(raster)m <- leaflet() %>%
addProviderTiles("OpenStreetMap") %>%
addCircleMarkers(data = breweries91) %>%
addHomeButton(extent(breweries91), "breweries91")
m
```![](figures/README-home.png)
#### 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")
```![](figures/README-query.png)
#### addLogo
```{r logo}
img <- "https://www.r-project.org/logo/Rlogo.svg"leaflet() %>% addTiles() %>% addLogo(img, url = "https://www.r-project.org/logo/")
```![](figures/README-logo.png)
### 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.