Out of Home Advertising Research with Python

Out of Home Advertising Research with Python
Photo by Terabass from wikimedia

Almost everyone is familiar with the phrase “location, location, location” when evaluating a property. Being mindful of location when purchasing out of home advertising placements is key to running successful outdoor campaigns. Python and the Here.com API can assist in location research when purchasing outdoor media (billboards, bulletins, and digital signage) remotely or when there are many locations to research. The full code an be found on GitHub.

This post outlines a method for querying nearby places corresponding to a set of geographical coordinates associated with out of home media placements. Researching nearby places can enable you to determine whether the location is brand friendly and consistent with your campaign messaging and target audience.

There are 3 files that you’ll need:

  • credentials.yaml
  • boards.csv
  • proximity_ooh.py

credentials.yaml

The file credentials.yaml is where you’ll specify your app id and app credentials to authorize access to the Here.com API.

boards.csv

The file boards.csv should contain data about the outdoor media placements that you’re interested in researching. In the template there are four columns, Media, Location, Latitude, and Longitude. The sample entry is for a placement in Times Square. The data for this row is Billboard, One Times Square, 40.7564, -73.9865. Usually the outdoor media seller will provide you with this information.

proximity_ooh.py

The file proximity_ooh.py is the python script that will query places nearby the coordinates associated with each placement. The script will then create a text file for each placement that lists places at or nearby those geographical coordinates.

First import the following packages:

Next define helper functions. The places_init function will load your API credentials from the yaml file. The at_nearby function will query the Here.com API for places at and places nearby the coordinates associated with a placement. The requests are then stored as dictionaries. The data associated with the keys title, position, distance, and vicinity are then written to a file named after the corresponding row in the Location column in boards.csv. The function at_nearby is written with a functional programming approach. It is later used with the map function in the WriteResults function.

places_init

at_nearby

WriteResults

The write results function will read the input .csv (in this example boards.csv) and write query results for nearby places’ title, position, distance, and vicinity to text files. There will be one text file for every row (i.e. out of home placement) in the input csv.

Finally, we run the sample example by calling the places_init function and then calling WriteResults.

Below is a truncated version of our results that will appear in the file One Times Square.txt

NEARBY

Nypd
[40.756376, -73.986431]
6
7th Ave<br/>New York, NY 10036

Iscream by Ice & Vice
[40.75628, -73.98647]
14
Broadway<br/>New York, NY 10036

BMO Bank of Montreal
[40.756274, -73.986393]
17
1485 Broadway<br/>New York, NY 10036

And further along in the file:

PLACES AT

Bubba Gump Shrimp Co
[40.75701, -73.98621]
72
1501 Broadway<br/>New York, NY 10036

Levi’s
[40.7571, -73.9864]
78
1501 Broadway<br/>New York, NY 10036

Tony’s di Napoli
[40.75641, -73.98547]
87
147 W 43rd St<br/>New York, NY 10036

H&M
[40.75603, -73.98573]
77
1472 Broadway<br/>New York, NY 10036

With this output we can get a sense of what other business and points of interest are around our the prospective billboard. This information can aid in determining whether the billboard is a good fit for a campaign and negotiating rates.

Leave a Reply

Your email address will not be published. Required fields are marked *