general1867 wordsRead on Arc Codex

How Many Tobacco Shops Are Near Your Town’s Schools? Using Georeferenced Data Analysis for Location

An investigation in Brazil found this convenience store selling both tobacco and vape products as well as goods for children near a public school. Image: Courtesy of the author How Many Tobacco Shops Are Near Your Town’s Schools? Using Georeferenced Data Analysis for Location-Based Investigations Have you ever wondered what it would look like to have a list of every hospital in a city and map how close, or how far, they sit from vulnerable communities? Or to check whether there’s a correlation between gas stations, bars, and liquor distributors? Or whether poor neighborhoods have the same ratio of healthcare facilities, police stations, fire departments, and schools as wealthier ones? No single list can answer questions like these, but there is a workable method for building the databases and maps that can. Every journalistic investigation starts with a good question, and a good question is rarely answered by a single source. The Map of Tobacco Shops project, produced by O Joio e O Trigo and funded by ACT Health Promotion, in which we identified more than 1,500 tobacco retailers within 100 meters of schools across Brazil, began with exactly that kind of question. This article walks through the process that connected our starting point to the answers we eventually found. Data journalism runs into a familiar tension: we chase quantifiable data while also trying to show how it plays out in everyday life. Maps are one of the best tools for bridging that gap. Behind every map is a dataset built on what we call georeferenced data, essentially two columns, latitude and longitude, that let any row in a spreadsheet be plotted visually. Obtaining Georeferenced Data on Different Types of Businesses Public databases that list institutions like schools, hospitals, and libraries usually already include data points like their addresses. But when you’re investigating businesses that aren’t publicly registered, or that operate in regulatory gray zones, georeferenced data becomes much harder to find. In those cases, you often have to build the dataset yourself. This is where the Google Places API, which pulls in data from businesses listed on Google Maps, can be a way in. There’s a kind of paradox at the heart of this method, and it works in journalism’s favor: businesses that dodge official registration to avoid inspection still want to be found by customers. That gap is what makes the method replicable. Google Places ends up functioning as an unofficial, voluntary registry of these businesses. For the investigation into tobacco shops and schools in Brazil, everything started with the question: “How many tobacco shops are next to schools in Brazil?” I had walked past enough of these shops to notice how often they sat right beside schools, and how often minors were among their customers. What I lacked was a method to measure the scale of the problem nationwide. So I opened Google Maps and started searching for tobacco shops near my own house, just to get a feel for the tool. That kind of exploratory search matters. You need to open Maps, run manual searches, and take note of which terms return the best results. Since the Google Maps API comes with a tiered pricing plan and a limited amount of free data pulls per month, you need to be precise in your searches to avoid running up unnecessary charges. Knowing which search terms work best before you scale up saves you from wasting that quota on guesswork. The API is what lets you collect this data at scale, since Google Maps itself only searches near wherever the map happens to be centered on screen. Through the API, you can query a whole series of cities, states, or countries automatically. The tighter your geographic scope, the fewer requests you need, which helps keep the project within Google Cloud’s monthly free credit (historically structured as a US$200 monthly credit, now managed through free monthly requests quotas per API). The free usage threshold varies for each category, you can check the free usage threshold on Google Developers website. For larger projects, it’s worth estimating your call volume in advance to plan the budget. If your goal is to cross-reference your Google Map output with official data, like the locations of schools or hospitals, or figures like epidemiological records or crime statistics, look for open government databases, NGO datasets, or file freedom-of-information requests. Combining public records with the data you collect makes the investigation stronger. In extreme cases, in regions that simply lack official data, this method can also help fill the gap. If you don’t have access to an official database of public establishments, you can replicate the method with Google Places instead, but it’s essential to check how closely that data matches reality on the ground. Breaking Down the API, Collecting the Data, and Cleaning the Database Once you’ve tested different search terms and noted which ones return the best results, it’s time to automate the collection. The script works like this: it reads a list of places, which can be cities, states, or countries, and sends automatic requests to the API using a set of strategic keywords defined during the exploratory phase, such as “tobacco shop,” “vape shop” or “hookah store.” In my case, since Brazil has more than 5,000 municipalities, I downloaded a list of cities from the Brazilian Institute of Geography and Statistics (IBGE) and uploaded it as a CSV file. If your list is shorter, you can just list the places directly in Python. You could, for example, list the host cities of the 2026 World Cup and search for pubs and stadiums, then calculate how many pubs sit near each stadium. We won’t get into the finer details of the code here; the script is open and commented, so anyone can copy it and adjust the parameters. It’s also built to handle the API’s limits as they stood when I ran the collection, in the second half of 2025. It’s worth checking the API documentation for any changes since then. At the end of the scraping process, the code exports a consolidated final dataset. That table, packed with geographic coordinates, is exactly what feeds the distance calculation in the next script. Using Python to Cross-reference the Data and Find Matches Instead of checking proximity on a map by hand, this code automates the comparison at scale. It takes the geographic coordinates of each business and runs a spatial calculation that accounts for the Earth’s curvature to measure the real distance, in meters, to the nearest point. Comparing thousands of points against thousands of other points tends to slow down an ordinary computer. To get around that, the script was built with newsroom realities in mind: it splits the data into groups and uses spatial indexing shortcuts to calculate distances in seconds. You don’t need to master the underlying libraries; you just need to understand the logic and run the file. What the script delivers, in the end, is structured evidence for the story. It generates spreadsheets that automatically sort businesses by proximity, under 50, 100 and 200 meters (all of these thresholds can be adjusted), handing you data that’s already been processed and ready to become maps or drive specific lines of investigation. Replicating the Method in Other Contexts This method is replicable and works as a template for investigating almost any spatial relationship between two points. The logic of cross-referencing an official database with data scraped from mapping platforms applies to any situation where the government hasn’t mapped something adequately, or where businesses operate informally but still need an online presence to attract customers. In practice, you can adapt this same code for a range of investigative angles. Imagine mapping the spread of physical betting shops and unlicensed bingo halls around public schools, or cross-referencing the location of health clinics with per-capita income data. In environmental reporting, the technique can track infrastructure that supports illegal mining, like equipment stores and gold-buying shops, within the boundaries of Indigenous lands. The engine behind the script stays the same; you just change the API search terms and the official dataset you’re comparing against. The main caveat when adapting this technique to a new story is the need for rigorous verification. Because Google Places is built from a mix of crowdsourced and commercial input, its data is prone to “false positives,” businesses that have already closed or changed lines of work but are still listed on the map. So the data the script generates should be treated as a heat map and a statistical lead, not a final answer. Before publication, it’s essential to validate the cases the script flags through visual checks (using Google Street View) and, ideally, fieldwork. Digging into the Databases and Finding the Bigger Stories Human review is irreplaceable in reporting work like this. While cleaning the databases, I went through each business by hand. That step didn’t just make the data more reliable, it also surfaced stories that strengthened the piece. One business, for instance, operated as both a tobacco shop and a stationery store. It had been in the same spot for 10 years, selling school supplies to children and tobacco to adults from the same storefront and the same mixed customer base. I also found other cases along the way: a shop selling both toys and vape pods, and a convenience store that had gradually started selling tobacco too. Checking the data line by line is essential for anyone trying to catch the nuances that code and automation miss. And data-driven journalism guided by a human reporter also means you spend your shoe leather more wisely. Once the data is clean and verified, heading into the field with a real story, interviewing sources and taking photographs, is far more effective than wandering around hoping to stumble onto something. Data Visualization There are several tools for communicating this kind of data. For this story, we used Google Maps, which lets journalists with less data-visualization experience build graphic elements more simply. Flourish and QGIS are other good options but more complex. Limits and Ethical Considerations All data is a representation of reality, so it’s worth staying critical about the biases built into Google Places’ coverage. Keep in mind that this data comes from a mix of sources: company cars visiting locations and photographing them, satellite imagery, and self-reporting by the businesses themselves. Another concern is that data density tends to be lower in rural areas or regions with less infrastructure. It’s essential to verify that a business actually matches its listing before citing specific cases in your reporting. In the dataset we collected from Google, a number of businesses didn’t match their spreadsheet description at all. To check this, I used Google Street View and browsed through photos from different dates to confirm what I was looking at. Since this isn’t official data, extra editorial caution is essential before publication. Bruno Borges is a data journalist for the Digital Room, a partnership between Band and Google. He was a fellow of Open Knowledge Brasil (Escola de Dados) in partnership with the UK Embassy in Brazil (2026) and a fellow of ACT Health Promotion (2025). He also contributes to O Joio e O Trigo, Núcleo Jornalismo and InfoAmazônia.

How it works

Once you click Generate, Ollama reads this article and crafts 5 comprehension questions. Your answers are graded against the article content — general knowledge won't be enough. Score 70+ to count toward your certificate.

Questions are cached — you'll always get the same 5 for this article.