This report creates a web map to analyze different store ownership types for Starbucks locations, as well as the local competition, in the city of Bellingham in Washington state. Bellingham is a small college in northwestern Washington state, just 21-miles from the Canadian border. It contains Western Washington University, a college the author is visiting for his brother’s graduation commencement from the School of Business and Economics.

Check out the college here: WWU

This report is Part B of Lab #4 for GEOG588.

Logos here are used for academic purposes only.

Load packages

First, we load the packages for this analysis.

library(dplyr) # For data manipulation.
library(leaflet) # Leaflet is what we'll use for the main mapping.
library(sf)  # To use features.
library(leafem) # Leafem will be used to add other functionalities to our map. 
library(readr) # To read our CSV file.

Data Wrangling

Then, we set up our data. The dataset comes from a global directory of Starbucks stores with information such as store number, address, and lat/long. Additionally, data was obtained for a local coffee chain competition called Woods Coffee from their company website. The addresses were geocoded manually in google maps and inputted into a new csv file called “directory_v2.”

Check out Woods Coffee here: Woods Coffee

(starbucks_belwa = read_csv('directory_v2.csv') %>% # choose the dataset.
  filter(City %in% c("Bellingham")) %>% # Select stores in Bellingham
  filter(State %in% c("WA")) %>% # and the state is WA
  st_as_sf(coords = c("Longitude", "Latitude"), crs = 4326) %>% # set coordiantes
  select(brand = `Brand`, store_name = `Store Name`, ownership_type = `Ownership Type`, address = `Street Address`, city = City, State = State)) # These are the columns/variables to be selected.
## Rows: 25607 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (11): Brand, Store Number, Store Name, Ownership Type, Street Address, C...
## dbl  (2): Longitude, Latitude
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Simple feature collection with 21 features and 6 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -122.51 ymin: 48.71 xmax: -122.44 ymax: 48.81
## Geodetic CRS:  WGS 84
## # A tibble: 21 × 7
##    brand store_name ownership_type address city  State        geometry
##    <chr> <chr>      <chr>          <chr>   <chr> <chr>     <POINT [°]>
##  1 Star… S. Sammis… Company Owned  222 36… Bell… WA    (-122.47 48.73)
##  2 Star… Barkley V… Company Owned  2915 N… Bell… WA    (-122.44 48.77)
##  3 Star… Bellis Fa… Company Owned  1 Bell… Bell… WA    (-122.49 48.79)
##  4 Star… Sunset Dr… Company Owned  1185 E… Bell… WA    (-122.46 48.77)
##  5 Star… Old Fairh… Company Owned  3105 O… Bell… WA    (-122.48 48.71)
##  6 Star… Western W… Licensed       156 E … Bell… WA    (-122.49 48.73)
##  7 Star… Iowa & Ki… Company Owned  814 Io… Bell… WA    (-122.46 48.76)
##  8 Star… Bakerview… Company Owned  1031 W… Bell… WA    (-122.51 48.79)
##  9 Star… Safeway -… Licensed       1275 E… Bell… WA    (-122.46 48.77)
## 10 Star… Fred Meye… Licensed       1225 W… Bell… WA    (-122.51 48.79)
## # ℹ 11 more rows

A view of the data:

starbucks_belwa
## Simple feature collection with 21 features and 6 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -122.51 ymin: 48.71 xmax: -122.44 ymax: 48.81
## Geodetic CRS:  WGS 84
## # A tibble: 21 × 7
##    brand store_name ownership_type address city  State        geometry
##    <chr> <chr>      <chr>          <chr>   <chr> <chr>     <POINT [°]>
##  1 Star… S. Sammis… Company Owned  222 36… Bell… WA    (-122.47 48.73)
##  2 Star… Barkley V… Company Owned  2915 N… Bell… WA    (-122.44 48.77)
##  3 Star… Bellis Fa… Company Owned  1 Bell… Bell… WA    (-122.49 48.79)
##  4 Star… Sunset Dr… Company Owned  1185 E… Bell… WA    (-122.46 48.77)
##  5 Star… Old Fairh… Company Owned  3105 O… Bell… WA    (-122.48 48.71)
##  6 Star… Western W… Licensed       156 E … Bell… WA    (-122.49 48.73)
##  7 Star… Iowa & Ki… Company Owned  814 Io… Bell… WA    (-122.46 48.76)
##  8 Star… Bakerview… Company Owned  1031 W… Bell… WA    (-122.51 48.79)
##  9 Star… Safeway -… Licensed       1275 E… Bell… WA    (-122.46 48.77)
## 10 Star… Fred Meye… Licensed       1225 W… Bell… WA    (-122.51 48.79)
## # ℹ 11 more rows

Analysis

Here, we set the color palette for our map. The colors chosen come from local sports team colors such as the Seattle Seahawks.

pal <- colorFactor(c("#52E74B", "#808080", "#0000FF"), starbucks_belwa$ownership_type) # select the color by hex code and the column to be colorcoded.

Now, we create the map.

leaflet(data=starbucks_belwa) %>%  # select the data
  addProviderTiles(providers$Stamen.Toner) %>%   # we'll use Stamen.Toner to make the map colors 'pop.'
  addCircleMarkers(radius = 8,  # add the markers
                   color = ~pal(ownership_type), 
                   fillOpacity = 1,
                   stroke=FALSE,
                   label = ~store_name,
                   popup = paste0("Brand: ", starbucks_belwa$brand, ". ",   
                                  "Store Address: ", starbucks_belwa$address)) %>%
            # The popup will show the name of the store, either Starbucks or Woods Coffee, and the address.
  addLegend(pal = pal,   # Add a legend
          values = ~ownership_type,
          opacity = 0.8,
          title = "Store Ownership Type") %>%
  addMiniMap(position = "bottomleft") %>%   # Add a minimap to show Bellingham in WA state.
  addMeasure() %>%   # Add a measuring tool
  leafem::addMouseCoordinates()   # Add coordinates to show up wherever the mouse is, from leafem.

Conclusion

From our map result, it can be seen that Starbucks (shown in green and blue) is pretty neck-in-neck with the competition, Woods Coffee (shown in grey). There are nine Starbucks locations, whereas there are seven Woods Coffee locations in the city. The distribution of the stores are also similar, with locations being close to each other. The Starbucks locations are within about a 1-2 mile radius from Woods Coffee locations, as measured by the “Measure” tool. For the Starbucks locations, most (five) are company-ownded, while there are three licensed stores. The distribution of the stores also show that there may be underserved areas to the east and north-northwest sections of the city.

References:

Starbucks (2020). Logo. creative.starbucks.com. https://creative.starbucks.com/logos/

Wikipedia (2023). Bellingham, Washington. wikipedia.org. https://en.wikipedia.org/wiki/Bellingham,_Washington

Woods Coffee (2023). Woods Coffee Locations. woodscoffee.com. https://woodscoffee.com/pages/locations)