Uncovering Location Intelligence Insights with SafeGraph Data
Written on
Chapter 1: Introduction to SafeGraph and Location Intelligence
SafeGraph offers a wealth of dynamic, location-based data that can be harnessed for insightful research. In this discussion, we will explore how to derive significant insights by utilizing their offerings.
On their platform, SafeGraph claims to have amassed over 11 million records related to Points of Interest (POIs), encompassing data on various locations and brands. Their documentation outlines three primary datasets: places, geometry, and patterns—recently expanded to include a Spend dataset. This article will guide you through a practical use case involving SafeGraph's data, integrating these three core types.
Section 1.1: Utilizing SafeGraph API for Retail Insights
Let’s envision a scenario where I am the owner of a store that sees heavy foot traffic and requires more detailed information about its visitors. This leads me to focus on retail and grocery establishments—essentially locations that draw crowds, even during challenging times like a pandemic. I’ll use our family's go-to grocery store—Great Wall Supermarket (GW Supermarket), situated in Duluth, under an hour from Atlanta. My family enjoys Chinese cuisine, and I've built rapport with the staff, who appreciate my efforts to converse in Mandarin!
GW Supermarket is well-known locally for its extensive variety of food products and its sizable layout. Anecdotes abound of patrons traveling from neighboring states, filling large coolers with groceries, and making a swift return home. Let’s investigate whether SafeGraph can provide insights into the origins of GW Supermarket's visitors.
We can employ the SafeGraph core API to acquire the placekey for GW Supermarket, which we’ll use to query patterns information.
Success! We’ve obtained the placekey for GW Supermarket!
Section 1.2: Analyzing Visitor Patterns
Using the placekey, we can now extract relevant information through the SafeGraph core and monthly patterns API. The data reveals that Saturdays and Sundays are the most frequented days, while Mondays and Tuesdays see the least traffic. Personally, I prefer shopping later in the week.
The visitation analysis by hour indicates peak shopping times occur between 11 AM and 5 PM. I typically shop at GW around 10 AM or 2 PM, yet I've never closely monitored the busier times—though I have noticed some days when the store was particularly crowded. I’ll keep this in mind for future visits!
Additionally, visitors to GW frequently also visit Walmart, Costco, and McDonald's. For context, Walmart is directly across from GW, and the nearest Costco is 1.5 miles away, making this pattern understandable.
Chapter 2: Exploring SafeGraph Geometries
Now that we’ve examined the Places and Patterns functionalities of SafeGraph, let’s delve into another powerful feature: Geometries. This is particularly useful for analyzing and visualizing geospatial trends. I’m interested in identifying where GW Supermarket’s visitors predominantly come from—are they local, or do they travel from out of state?
The data frame detailing GW visitation consists of a single row, with certain columns containing dictionaries that help us understand visitor origins. Specifically, the ‘visitor_daytime_cbgs’ column lists the number of visitors and their primary census block group (CBG) ID. However, the CBG number alone doesn’t provide geographical insights. So, how can we derive the locations and geometries of these CBGs?
For this purpose, I refer to census data available from SafeGraph (which is free to download). The CBG geometries data is formatted in geojson, making it accessible through geopandas.
Finally, I save this data as geojson and utilize kepler.gl (refer to my recent article on kepler.gl) to visualize a Choropleth map. This map illustrates visitations by CBGs alongside the location of GW Supermarket (represented as a large yellow dot).
The visualization reveals visitors from CBGs beyond Georgia, including Tennessee and North Carolina! The tales of people traveling significant distances to shop at GW seem to hold some truth!
Takeaways
The insights gleaned from SafeGraph's data are extensive, and their API is remarkably user-friendly. While there aren’t numerous tutorials detailing specific use cases, this may be due to the company's relatively recent establishment. For businesses aiming to enhance location intelligence without investing heavily in infrastructure, SafeGraph offers an appealing solution.
The data is aggregated, which can be advantageous or disadvantageous depending on your requirements. On the plus side, SafeGraph conducts thoughtful preliminary analyses, allowing users to generate insights from well-formatted data. Furthermore, this aggregation helps alleviate certain privacy concerns. However, the downside is that it might obscure some granular visitation insights that could be valuable.
In summary, SafeGraph is an excellent resource for deriving location insights. Recent studies utilizing SafeGraph data have effectively addressed crucial research questions, particularly regarding movement patterns during the COVID-19 pandemic. I anticipate that the number of researchers and businesses leveraging SafeGraph for location intelligence will continue to increase in the years ahead!
If you enjoyed this article, consider following me for more insights—I frequently explore the intersections of complex systems, physics, data science, and societal impacts.
Subscribe here for weekly data-driven perspectives!