Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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.