-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
62 lines (43 loc) · 2.63 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# bingmapr
<!-- badges: start -->
[![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)
<!-- badges: end -->
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))
```