Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/elipousson/bingmapr

An R package for accessing the Bing Maps Static Map API 🌐🖼️ 📦
https://github.com/elipousson/bingmapr

bing-maps bing-maps-api r r-package r-spatial

Last synced: about 2 months ago
JSON representation

An R package for accessing the Bing Maps Static Map API 🌐🖼️ 📦

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# bingmapr

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

bingmapr is an R packge for retrieving and plotting maps from the [Bing Static Maps API](https://docs.microsoft.com/en-us/bingmaps/rest-services/imagery/get-a-static-map). I created this package in May 2021 primarily to to access Bing's Bird's Eye (oblique-angle) imagery so the routes and traffic features of the API are not currently supported. There are no immediate plans to add these features to the package but pull requests are welcome.

This package is inspired by the [snapbox package](https://github.com/anthonynorth/snapbox/) that allows the use of the maps from the Mapbox static map API in ggplot maps. I hope to integrate bingmapr with ggplot in the future.

You can also explore the static map API in the browser using the [Bing Static Map Maker](https://staticmapmaker.com/bing/) made by [Katy DeCorah](https://katydecorah.com/).

## Installation

You can install the development version of bingmapr from [GitHub](https://github.com/) with:

``` r
# install.packages("pak")
pak::pkg_install("elipousson/bingmapr")
```

## Example

This package requires a Bing Maps API Key which you can get here: https://www.bingmapsportal.com/

```{r set_key, eval = FALSE}
bing_maps_api_key(key = "put your key here", install = TRUE)
```

Here are examples you can run with an installed key:

```{r example, eval = FALSE}
# Get request URL centered on Washington Square Park in New York, NY
get_request_url(location = c(40.7308349, -73.99746074), orientation = "W")

# Get an sf object to show how bingmapr can use sf objects for locations
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))

# Plot a static map showing the center of Wake County, North Carolina
get_map_image(location = nc[nc$NAME == "Wake", ], orientation = 180)

# Plot static map centered 300 meters north and 500 meters west of the center
get_map_image(location = nc[nc$NAME == "Wake", ], orientation = 180, nudge = c(300, 500))
```