Blog
Ideas-of-Interest

Where Should I Shop to Minimize my Exposure to COVID-19?

September 2, 2020
by
SafeGraph

Thank you to makepath for their collaboration on this blog.

At makepath, we specialize in turning data into insights using open source spatial analysis tools. As the United States continues to adjusts to the COVID19 pandemic, we asked the question:

"It’s 12:00pm and I need to go to a store RIGHT NOW, where should I shop to effectively social distance?"

SafeGraph's Places Patterns dataset gives us the fine-grain foot traffic data we need to explore our question.  We can easily filter foot traffic based on retail categories, and visualize foot traffic to reveal structure in foot traffic patterns based on our stores of interest. 

We detail the analysis below and are sure you can use similar techniques to explore your own analysis questions. We opted to use a raster-based approach, which demonstrates aggregation of data into spatially-aligned grids using Datashader, Xarray-Spatial, and Geopandas.

Like all spatial analyses, we start by defining our study area.  Our study area focuses on Austin, Texas and includes a willingness to travel radius of 5km. We use a geodesic radius which is why our area is an elliptical as opposed to purely circular.

We also added a street layer, to provide additional context to our study area. We obtained streets from the City of Austin’s Open Data Portal.  

Split, Apply, Combine for Spatial Insights

A common data analysis pattern is split, apply, combine. We can use this paradigm to frame the steps needed to answer our social-distancing question.

  1. Split your data into groups

Split is the action of dividing data into meaningful groups. For our question, we split up SafeGraph Places Patterns data into groups based on retail category.  SafeGraph provides dozens of retail categories, and hundreds of retail subcategories.

Our retail categories of interest included:

  • Pharmacies
  • Supermarkets
  • Veterinary Services
  • Used Car Dealers
  • Women’s Clothing Stores
  • Hardware Stores
  • Retail Bakeries
  • Paint and Wallpaper Stores
  • Jewelry Stores
  1. Apply transforms to gain insights

During our Apply step, we run each group of stores through a series of transforms.  At this stage, each retail group is considered independently.  SafeGraph’s data includes everything we need to know about our retail stores including popularity by time, popularity by day of week, square footage, and lat/lng location.

For our analysis, the following transforms were applied to each retail category:

  • Spatially-align retail stores with our study area through rasterization.
  • Generate a foot traffic surface to visualize patterns.  This is done using Inverse Distance Weight interpolation and shows sparser trafficked areas in green, and denser trafficked areas in orange.
  • Normalize foot traffic values by the square footage of the retail location.
  • Select the retail store with least foot traffic normalized by square footage.
  • Draw a line (lime green) from our current location (center pink dot) to the best choice retail store based on where we believe we can most effectively social distance.

 

  1. Combine transformed data into final outputs

With our split and apply stages complete, we can now combine our transformed location layers into a single for each retail group. This step is easy because we’ve already spatially-aligned each of our layers using Datashader and Xarray-Spatial.  We can mosaic our output images together to look at various retail sectors and compare them visually. 

Ok, so where should we shop? Below is a table of the best retail location we identified based on our time of day (12pm noon) and the retail segment of interest:

Retail Category Store Name Store Address
Pharmacies and Drug Stores CVS 2021 Guadalupe St.
Supermarkets and Other Grocery (except Convenience) Stores The Four Five 5212 Manchaca Rd.
Veterinary Services VCA Animal Hospitals 2417 W Ben White Blvd.
Used Car Dealers Peddle 111 W 6th St. Ste. 300
Women's Clothing Stores Bird 1500 S Lamar Blvd. Ste. 140
Hardware Stores Bluebonnet Custom Roofing 600 Congress Ave. Fl 14
Retail Bakeries Cakes ROCK 4201 S Congress Ave Ste. 101
Paint and Wallpaper Stores Michael Yates Design 405 Springdale Rd.
Jewelry Stores Texas Custom Boots 1601 S 1st St.

SafeGraph + Open Source GIS Tools = Super-charged Data Analytics

The most powerful tools for understanding our world exist within the open source software community.  The best data for understanding foot traffic data comes from SafeGraph.  Combined, analysts can uncover critical insights to help decision-makers achieve the best outcomes possible for their organizations.

We challenge you to use similar spatial analysis techniques in answering your own questions.  By leveraging SafeGraph data with tools like Datashader and Xarray-Spatial, you are limited only by the insightfulness of your questions.

To see the technical aspects of this blog put into action via code, check out the accompanying notebook

---

Brendan Collins is Founder and Principal of makepath, a spatial data science firm in Austin, Texas. The team at makepath is passionate about open source spatial analysis tools and using open source GIS libraries to solve tough data problems such as identifying pharmacy deserts.

SafeGraph
SafeGraph
The Source of Truth for Physical Places
TwitterLinkedin
SafeGraph is just a data company

That's it – that's all we do. We want to understand the physical world and power innovation through open access to geospatial data. We believe data should be an open platform, not a trade secret. Information should not be hoarded so that only a few can innovate.