This is part 2 of a 4-part series on The Making of Manhattan’s Coffee Kings. Read Part 1.
By this time, we had the shapefiles for Manhattan (by census tract), the population of each tract, and the location (in Sheet1) of coffee shops around Manhattan. The next step was to create the “coffee map” of Manhattan.
To merge the population data into the shapefile, I used geopandas — a slightly-complicated-but-better-than-alternatives Python library to work with Shapefiles. The code is here. What we did was:
Normally, this would have sufficed. But after several minutes of debugging, I found two other issues with the shapefile.
If you didn’t understand the projections bit, don’t worry. I don’t get it either. But if I find that my shapes are in the wrong place, I usually spend 10-20 minutes of trial and error on the projection, and something usually works.
I used geopandas again to take all the stores and check if they were within the Manhattan shape boundary. The result is a 288-row CSV file with the latitude, longitude, address and store name (Starbucks or McDonald’s).
Running the script manhattan.py creates 3 maps:
single.shp with Manhattan’s boundary as a single regionpoints.shp with the coordinates of individual storespopulation.shp with the census tract and populationTo create the coverage area, I used QGIS’ Voronoi Polygons. This splits Manhattan into regions that are nearest to each store.
I followed these steps.
pointssinglevoronoi-stores.shpvoronoi-stores.shp is a shapefile that has the coverage area of each store.
A naive but effective way of finding the population of any region is to assume that the population is uniformly distributed.
For example, the Starbucks at 120 Church Street is entirely within the census tract CT 002100 in Little Italy and covers 18.5% of its area. So we can assume that this Starbucks serves 18.5% of the 6,040 people in the tract, i.e. 1,120 people.
I wrote a utility merge.py to automate this calculation. By running this command:
python reshaper/merge.py voronoi-stores.shp population.shp \
manhattan-stores.shp -m Pop2010 … I was able to merge the census population data into the coverage area map.
What Makes Ethereum Casino Stand Out?Ethereum Casino brings a fresh spin to online gambling by… Read More
The Pulse of Fast Play – Why Short Sessions RuleIn a world where time is… Read More
Every time you pull up your phone and tap the Pokies96 logo, you’re stepping into… Read More
National Casino si è ritagliato una nicchia offrendo ai giocatori che desiderano brividi istantanei e… Read More
High‑Intensity Play, Low‑Time CommitmentIn a world where seconds matter, Woolworths Casino offers a playground designed… Read More
Sol Casino has emerged as a favorite for players who love short, high‑intensity sessions where… Read More
This website uses cookies.
Leave a Comment