index.md

mapboxapi

mapboxapi is an R package that interfaces with Mapbox web services APIs. Its purpose is to help R users incorporate the suite of Mapbox tools into their spatial data science projects. Install from CRAN with the following command:

install.packages("mapboxapi")

To get started, sign up for a Mapbox account and generate an access token. Set your public or secret token for use in the package with mb_access_token():

library(mapboxapi)
mb_access_token("pk.eyas...", install = TRUE)

Once you've set your token, you are ready to get started using the package. The following example integrates Mapbox maps, navigation, and search services to plot a five-minute walking isochrone over an interactive Leaflet map using a Mapbox style:

library(leaflet)

walk_5min <- mb_isochrone("2850 S University Dr, Fort Worth TX 76129",
                          profile = "walking",
                          time = 5)

leaflet(walk_5min) %>%
  addMapboxTiles(style_id = "streets-v11",
                 username = "mapbox") %>%
  addPolygons()

Read through the following articles to see what you can do with the package:

If you find this project useful, consider supporting package development via PayPal, hiring me to give a workshop on mapboxapi or hiring me to consult on your project. Send me a note at kyle@walker-data.com if this interests you! You can also get updates on package development by signing up for my newsletter:

</p> <h1>mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }</h1> <p>/<em> Add your own MailChimp form style overrides in your site stylesheet or in this style block. We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. </em>/

Please note: Use of Mapbox services through mapboxapi is governed by Mapbox's Terms of Service and any account restrictions.



walkerke/mapboxapi documentation built on Sept. 26, 2024, 6:26 p.m.