elipousson/bingmapr
An R package for accessing the Bing Maps Static Map API ππΌοΈ π¦
bingmapr
bingmapr is an R packge for retrieving and plotting maps from the Bing
Static Maps
API.
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 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 made by Katy
DeCorah.
Installation
You can install the development version of bingmapr from
GitHub with:
# 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/
bing_maps_api_key(key = "put your key here", install = TRUE)Here are examples you can run with an installed key:
# 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))