Now that it’s December, the holiday season is fully upon us. Here in the US, it is impossible to escape the season of gifting, even if you don’t celebrate Christmas. Whether for your office Secret Santa, to avoid showing up empty handed to a holiday party, or to appease your mother who always insists on getting you “just a little something” (that must be reciprocated), we all get drawn under by the tide of holiday shopping.
For some this is a more daunting task than others. A fellow Factualite, for example, explained to me the predicament of having to acquire gifts for his young nephew, parents, brother, and wife. To cater to the widely varying desires of these different people, he must make the time to visit a number of different stores. Especially when it comes to picking out things like jewelry for your wife, we agreed it was necessary to visit brick and mortar stores instead of simply shopping online.
Working at a company focused on location, we started thinking: what if you could optimize the gift acquiring problem by selecting one area to shop where all of the stores that you needed were within a walkable proximity of each other? With access to a comprehensive set of business data (Factual’s Global Places1) and a little math, this turns into a very reasonable problem. I started the analysis with my colleague’s shopping situation. For his nephew, he wanted to get a set of Legos; for his parents and brother, new tablets; and for his wife, earrings. I broke this down into three Factual Place Categories:
Next I searched for all of the locations that fit these criteria in Los Angeles and a few nearby cities2:
By inspection, you start to get a sense for what areas are best. However, I didn’t just want to see areas where the desired stores are close, I wanted to see where they are walkable. To do this I used the Haversine formula3 to calculate how many of each store where my colleague could purchase a gift for his parents and brother were within walking distance (which I defined as within a radius of 0.15 mi) of each store for his nephew.
I plotted the results below, where each point represents a toy store. The darker the point, the more electronics stores are within walking distance.
I then repeated this process for each pair of gifts (six total):
To get a more holistic look at the picture, I generated a final map with all three kinds of stores, taking into account their proximity to each other. Like the maps above, the darker the point, the more stores of the other two kinds are within walking distance. For example, a dark red point indicates a jewelry store that is walking distance from a relatively large number of toy and/or electronics stores. Using this map, I identified three preferred shopping areas in Santa Monica, Beverly Hills, and Downtown LA4.
Since I know many of you do not live in Los Angeles, I also generated this summary map for New York, Chicago, San Francisco, and London:
Where I grew up, if you don’t celebrate Christmas, you probably have a tradition of going to the movies and eating Chinese food on the eve of December 24 (as my family did). If this is your preferred holiday alternative, the maps below can help you decide which theater to go to based on how many Chinese restaurants you can walk to after your movie5:
Best of luck with your Holiday shopping!
- Julie Levine, Marketing Associate
1) Factual’s Global Places data contains over 65 million business listings and points of interest worldwide, with such attributes as business name, street address, latitude and longitude, and more.
2) If you’d like to run these types of queries yourself, here’s an example of how to query for toy stores in LA using the Factual Ruby Driver:
factual.table("places-us"). filters("category_ids" => "173", "locality" => "LOS ANGELES", select(:name, :latitude, :longitude)
3) It is worth noting that the Haversine formula is derived for a perfect sphere, while the Earth is actually roughly ellipsoidal. Although we typically expect errors below 0.3%, they can range up to 0.55% at the equator.
4) This approach does not indicate if a jewelry store is walking distance from only toy or only electronics stores, or a combination of both. To determine this, you can refer to the earlier maps that show only pairs of stores.
5) Sample code for looking up movie theaters in New York:
factual.table("places-us"). filters("category_ids" => "332", "locality" => "NEW YORK"). select(:name, :latitude, :longitude)
Sample code for looking up Chinese restaurants in New York:
factual.table("restaurants-us"). filters("cuisine" => "CHINESE", "locality" => "NEW YORK"). select(:name, :latitude, :longitude)