View Missed along №1 Train

Qigao Wang
Data Mining the City
6 min readDec 11, 2017

Team Member: Weijian Bi, Hui Liu, Qigao Wang, Shaochun Zhou

Background: The New York City Subway is one of the world’s oldest public transit systems. With 472 stations (metro system with the most stations)and a operating route of 369 kilometers (229 miles). It offers service 24 hours per day on every day of the year and carried 1.76 billion people in 2016 with 5.7 million ridership in every weekdays. Thanks to the never-ending congestion of the city’s road transit, the NYC Subway, with its high capacity, congestion-free experience and flat fare, has become the first choice for most commuters of the city.

Though it may be one of the most mature underground transit in the world, traveling through NYC Subway towards to most of New Yorkers as well as local residences from different regions. However, traveling with New York Subway gives you an entirely different experience compared to taking a bus.Here we are not judging the noise, sultriness or trash problem, but we feel really sorry for how much beautiful scenery subway riders have missed.

First, let’s compare what you will experience when you decide to depart from Time Square by taking a subway:

Subway — Underground:

But if you decide to travel on the ground, you will see:

Research purpose: As a group of four international students, some of us rely on 1 Train for daily commute from the campus to where we lived. It’s routine for us to kill the trip time by reading books and listening music, but we’ve never had such thought about what is happening and what we’ve missed in the overground world. Now with the technology support and the curiosity about the things that are happening on the ground, we had an idea to make an imitation by displaying the street view along a certain subway route. If one day such approach could be put into application on carriages of subways, then travelers in New York can simultaneously enjoy the efficient commute and colorful scenery.

Significance: This project is significant for New Yorkers and out-comers who are curious about the missing scenes while traveling by subway. This sequence could be used to recall commuters’ passions in urban texture. Additionally, the street view images could recall the pieces of memories of people who just visit or lived in this world famous Morden City. By incorporating the street images from viewers’ physical locations, people can enjoy the continuous street view video on the ground. Hopefully, this function could be added into Google maps and help more people live in urban area in near future. For example, it provides a potential tool for people who loves driving, so they can simulate from driving experience to choose the best routes for others.

Methods and Results: We get the coordinate every 5 meters along the route of №1 train by using GIS, and return the street view images of each location. We start with Qigao’s apartment which located in Midtown Manhattan and end with Columbia University to create an interactive google street view sequence above ground along Line 1 by using Processing Python and make a visual experience for him in order to show the missing scenes he missed everyday.

A continuous street view sequence is represented below. We use three different angle which are West, East,and North while the 1 train moving. The views that showing which we can not see underground.

Conclusion:This Project aims to represent the street view sequence along №1 train by using python. As we can see, when we travel underground, there are so many scenes we missed on the ground which include sky scrappers, landmarks, historical districts, and beautiful leafy trees. Obviously, the data from online dataset has potentials to change people’s reception of the cities, and provide the way by which they could find the goodliness of the places they live in. With this first trial and more ideas coming to us in the future, we really wish that street view visualizing catch back the above grade life for the below grade traveler, and make the daily commute no longer boring and tedious.

Output and Code:

Data Cleaning:

Step 1: Get the coordinates along Line 1 from 116st to South Ferry using GIS

  • Add line 1 shapefile into GIS platform.
  • Use “Generate points along lines” Tool and divide it by distance (5 meters)
  • Add XY coordinates into new layer and export the location information of each point
  • Save it as “subwaylocation.csv”

Step 2: Check the point

import spatialpixel.mapping.slippymapper as slippymapper
import csv
def setup():
size(1000, 800, P2D)
pin = loadImage("https://s3.amazonaws.com/spatialpixel/maps/map-pin-10px.png")
global nyc
nyc = slippymapper.SlippyMapper(40.715, -73.999, 12, 'carto-light', width, height)
nyc.addMarker(40.80813, -73.96358, "116 st")
nyc.addMarker(40.70174, -74.01297, "South Ferry")
with open('Subwayline2.csv') as f:
reader=csv.reader(f)
header=reader.next()
for row in reader:
latitude=float(row[0])
longitude = float(row[1])
nyc.addMarker(latitude, longitude, pin)
nyc.render()
def draw():
background(255)
nyc.draw()

Step 3: Download the streetview images using Processing

import locationscsv
locations = []
reader = csv.reader(locationscsv.data.splitlines())
is_first_row = True
for row in reader:
if is_first_row:
is_first_row = False
continue
lat, lon = float(row[0]), float(row[1])
location = (lat, lon)
locations.append(location)
api_key = "AIzaSyBmBfMOXWE4TNGM0cNrhpYEh-XgTG3mLG4"api_url = "https://maps.googleapis.com/maps/api/streetview?size=640x400&location={0},{1}&fov=90&heading={2}&pitch=10&key={3}"
row = 2
headings = [0, 90, 180, 270]
for location in locations:
for direction in headings:
lat, lon = location
url = api_url.format(lat, lon, direction, api_key)
filename = "location-{0}-{1}.jpg".format(row, direction)
urllib.urlretrieve(url, filename)
print "Got %s" % (filename,)
row += 1

print "Done"

North, south, east, and west images from each location are saved.

Visualization Code:

Underground:def setup():
size(600, 600)
frameRate(1)

global p1
p1 = loadImage("1.JPG")
global p3
p3 = loadImage("IMG_0103.JPG")
global p6
p6 = loadImage("IMG_0155.JPG")
global p7
p7 = loadImage("IMG_0148.JPG")
global p10
p10 = loadImage("IMG_4627.JPG")
global p12
p12 = loadImage("IMG_0179.JPG")

def draw():
x = random(0,width)
y = random(0,height)
z = random(100,300)

noStroke()
image(p1,x,x,z,z)
image(p3,x,y,z,z)
image(p6,y,y,z,z)
image(p7,x,z,z,z)
image(p12,y,x,z,z)
image(p10,y,z,z,z)
Above the ground with map: import spatialpixel.mapping.slippymapper as slippymapper
import csv

def setup():
frameRate(15)
size(1000,800)
global route,infoList, infoCounter
global images1,images2,images3
images1 = []
images2 = []
images3 = []
stationList = []
infoCounter = 0
infoList = []
listCounter = 0

for i in xrange(2, 500):
filename = "location-"+str(i) + "-90.jpg"
img1 = loadImage(filename)
images1.append(img1)

for i in xrange(2, 500):
filename = "location-"+str(i) + "-270.jpg"
img2 = loadImage(filename)
images2.append(img2)

for i in xrange(2, 500):
filename = "location-"+str(i) + "-0.jpg"
img3 = loadImage(filename)
images3.append(img3)


route = slippymapper.SlippyMapper(40.793183, -73.971763, 12, "carto-light",1000,800)
route.addMarker(40.807779, -73.962197,"Columbia University")
route.addMarker(40.773556, -73.982668,"The Juilliard School")

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

for row in reader:
infoList.append([])
latitude = float(row[0])
longitude = float(row[1])
infoList[listCounter] = [latitude,longitude]
listCounter += 1
f.close()

with open("5meter.csv") as g:
reader = csv.reader(g)
header = reader.next()

for row in reader:
infoList.append([])
lati = float(row[0])
longi = float(row[1])
spot = (lati,longi)
route.addMarker(lati,longi,RouteMarker(spot))
g.close()

with open("station.csv") as k:
reader = csv.reader(k)
header = reader.next()
for row in reader:
stationList.append([])
statLat = float(row[1])
statLong = float(row[2])
route.addMarker(statLat,statLong)
k.close()

route.render()

def draw():
global infoList,infoCounter,route
background(255)
route.draw()
fill(0)



image(loadImage("1trainlogo.png"),390,745,25,25)
image(loadImage("1trainlogo.png"),700,40,25,25)
img1 = images1[infoCounter]
img2 = images2[infoCounter]
img3 = images3[infoCounter]
image(img2,175,75,200,200)
image(img1,625,75,200,200)
image(img3,400,75,200,200)

ellipse (route.lonToX(infoList[infoCounter][1]),route.latToY(infoList[infoCounter][0]),15,15)

infoCounter += 1

if infoCounter == 499-1:
infoCounter = 0

class RouteMarker(slippymapper.DataMarker):
def drawMarker(self, x, y, marker):
marker.noStroke()
marker.fill(255,0,0)
marker.ellipse(x,y,5,5)

Data:

Subway Lines Data: in Shapefile format

Map: Slippymapper

Google Street view API

Other supporting data

--

--