Scraping Geo Data to Determine Accessibility to Pharmaceuticals
Read on... free dataset on pharmacies by location.
This February we are going to cover scraping geo data.
Last year, Walgreens and CVS announced the closure of hundreds of their chain stores, a staple to access medication in some small towns where locally owned pharmacies don’t exist. Last month, Walgreens pushed its plans to close 1200 stores forward, with 70 already shuttered. CVS closed 300 stores in 2024.
The Bright Data team worked on creating an interactive map that shows where these staples are concentrated and where they are lacking. We found with each natural disaster we had to review our work and eliminate one or two pharmacies, often in small towns. The latest review of this was prompted by the California wildfires, which impacted 1 pharmacy.
Since California is the most recently impacted, we’ll analyze the data from the State to draw insights from the datasets. Although we looked at multiple states and found a pattern that carried from state to state, you can infer the story is similar in your state.
California has many communities without immediate access to pharmacies. While some of these massive regions are national forests and wilderness areas, it’s apparent people who live in rural communities near these areas or in communities that connect small towns are in pharmacy deserts. A pharmacy desert is defined as an area that does not have a pharmacy within 10 miles of it. In mountainous and wilderness regions time and distance to access a pharmacy is even more distant because of few roads that navigate the terrain.
The red in map shows pharmacy deserts, defined as a point with no pharmacy within 10 miles. Download the interactive map of pharmacy deserts in the United States.
Most noticeably pharmacies are dotted along portions of the CA 99 corridor and coastal areas, which runs through some of the largest cities in the state. Eastern and Northern California have wide stretches of land with no pharmacies nearby. Modoc County as a whole only has three pharmacies and there are none near the county borders.
In some cases the location of pharmacies per capita may result in fewer pharmacists than the World Health Organization recommends for the population, which is 1 per 2000 people.
How did we collect the data?
Contributed by Data Expert, Michael Newton
Bright Data’s SERP API was used to search for “pharmacy+zip_code” on Google Maps. SERP API is a scraping tool that returns a structured JSON of search results that is parsed for key attributes of each business (fields collected are listed below). This collection is run multiple times to ensure all businesses are collected. Businesses that were temporarily closed and businesses that did not list pharmacy as a category were removed from the dataset. This filtered dataset last updated on January 30, 2025 contains 224,314 pharmacies.
Bright Data offers a pre-collected Google Maps dataset, but chose to use the SERP tool to account for urgent business changes related to recent natural disasters, i.e. California wildfires.
Python was used to create the map, after cleaning the dataset and validating the latitude and longitude for each business. The pharmacy dataset was converted into a GeoDataFrame allowing for spatial analysis and a GeoJSON file of state and county boundaries was loaded. Each pharmacy was plotted on a map based on latitude and longitude and given a 10-mile buffer around each point as an overlay to show areas with and without a pharmacy within 10 miles. The module Folium was used to create the interactive map allowing users to toggle different layers on the map to view areas of the country that are considered a pharmacy desert.
February Free Dataset
Dataset on pharmacy deserts in the United States with an interactive map
Ready to Use Datasets
Have another project in mind? In addition to web scraping tools, Bright Data’s marketplace is free and accessible to journalists. We recently added Facebook Events and TikTok Shop to our list of more than 100 other ready-to-access datasets!
Here’s a link to the journalism program if you are interested in learning more.