DAT-4313 - GIS with R
ACQUIRE THE DATA
The following code will read the dataset in directly from data.world.
You may need to join data.world, but I think it works without joining. (Joining is free.)
If you’d rather download and then import, here is the location of the dataset:
https://data.world/data-hut/whataburger-restaurant-location-dataset
CREATE MAP FOR TEXAS LOCATIONS
Map Whataburger store locations JUST FOR in TX using leaflet package.
ACQUIRE TEXAS COUNTY-LEVEL POPULATION DATA FROM THE US CENSUS
Obtain your own census api key at: https://api.census.gov/data/key_signup.html
We will use the api key to directly download population data from the census.
OVERLAY WHATABURGER TO POPULATION
Let’s map the TX Population Census using the leaflet package.
This time we are using a different provider for the map: OpenStreetMap
Try swapping other maps – see a few below in the commented code.
The first image shows a map of Texas with blue markers indicating the locations of Whataburger stores across the state. The markers are concentrated in major cities and urban areas, particularly in the eastern half of Texas around Houston, San Antonio, Austin, and Dallas-Fort Worth. There are also clusters of Whataburger locations in other cities like Lubbock, Midland, and El Paso.
The second image overlays population percentile data on a map of Texas and surrounding states. The different shades of orange represent different ranges of population density, with lighter shades indicating higher population percentiles. The most densely populated areas in Texas are the major metropolitan regions like Houston, San Antonio, Dallas-Fort Worth, and Austin, shown in dark orange/brown. There are also smaller pockets of higher population density in other cities across the state.
By comparing the two images, we can see that Whataburger has strategically placed many of its store locations in areas with higher population densities, catering to the larger customer base found in urban and suburban areas. However, there are also Whataburger locations scattered in less densely populated regions, likely serving smaller towns and communities across Texas.