Digital New York Post Card

Shio
Data Mining the City
2 min readOct 20, 2017

Popularity of Tourists’ Destinations in New York

This Digital New York Post Card interactively shows the popularity of tourists’ destinations in NYC. The size of each place’s name differs depending on popularity of places, so we can easily know which places are popular in NYC. For example, when you move your mouse on a picture of central park, the name is too large to read. On the other hand, when you move your mouse a picture of farmers market, the name gets so small. Therefore, you can know the popularity of these places visually and easily.

The variable I used here is number of reviews from TripAdvisor.

import csvdef setup():
global img
size(1200,700)
#rename image to match your image name in your data folder

global images
images = []
for i in xrange(0, 84):
filename = str(i + 1) + ".png"
img = loadImage(filename)
images.append(img)



with open("Trips.csv") as f:
reader = csv.reader(f)
header = reader.next()

global reviews
reviews = []

global names
names = []

for row in reader:
review = float (row[2])
reviews.append(review)

name = row[1]
names.append(name)
def draw():
background(255)

imageSize = 100
numRows = height / imageSize
numColumns = width / imageSize

# Draw all the images first
for i in xrange(0, 84):
col = i % numColumns
row = floor(i / numColumns)
x = col * imageSize
y = row * imageSize
img = images[i]
image(img, x, y, imageSize, imageSize)

#title
textSize(230)
fill(250, 250, 250, 40)
text("NEW YORK", width/2-600, height/2+50)

# Draw the hover-over graphics here.
for i in xrange(0, 84):
col = i % numColumns
row = floor(i / numColumns)
x = col * imageSize
y = row * imageSize



overColumn = x < mouseX and mouseX < x + imageSize
overRow = y < mouseY and mouseY < y + imageSize
if overColumn and overRow:
noFill()
stroke(237, 59, 94)
strokeWeight(3)
rect(x, y, imageSize, imageSize)
fill(250, 250, 250)

if reviews[i] > 30000:
textSize(reviews[i] / 200)
fill(237, 59, 94)
textMode(CENTER)
text(names[i], x+15, y+50)
if 30000> reviews[i] > 1000:
textSize(reviews[i] / 100)
fill(237, 59, 94)
textMode(CENTER)
text(names[i], x+15, y+50)
if reviews[i] < 1000:
textSize(reviews[i]/50)
fill(237, 59, 94)
text(names[i], x+15, y+50)

--

--