Access to Green Space: A New Perspective of Evaluating Affordable Housing Quality

Angela Li
Data Mining the City
4 min readOct 20, 2017
#affordablehousing tweets around US in the past week

Project Idea

My project aims to evaluate affordable housing quality from a new perspective — — its access to green space.

Part I

Start from looking at the tweets with hashtag #affordablehousing all over US from 10/10 to 10/16, we can have a general sense about what do most people concerned about affordable housing. We can also notice that, there are relatively more affordable housing posts in east coast.

After looked at the tweet contents, we zoom into New York City, the very center of east coast to explore the geographic relationship between affordable housing units and green open space.

Part II

NYC Affordable Housing Units and Green Space Map

In this map, the green polylines stand for the parks in New York City while the white spots stand for each affordable housing units. But the units are too densely distributed, so we need to zoom in more to explore the geographic relationship in detail. (This map is also interactive. But it takes a long time to load so I screenshot the zoom in layout instead.)

Bronx and Brooklyn Comparison

I chose Bronx and Brooklyn to zoom in as both boroughs have the higher density of affordable housing units. It is obviously shown in the map that affordable housing units in Bronx have a better access to green open space.

Green space around affordable housing units in Bronx are large and dense where that in Brooklyn are relatively small and scattered. It implies that more green space should be developed around Brooklyn’s affordable housing units. Access to open green space should also be considered as an important factor in future affordable housing design in the city.

In fact, since last year, the city has already released several reports discussing incorporating active design into affordable housing design. Active design includes elements such as exercise facilities and open space which significantly affect the living quality of residents.

Based on the finding of my project, more efforts should be put into developing and incorporating active design, which eventually lead to a better living quality of affordable housing units in New York City.

Data Source:

  1. NYC Open Data
  2. Twitter API
  3. SlipperMapper

Code

  1. US Tweets Map Code Script
import spatialpixel.mapping.slippymapper as slippymapper
import json
def setup():
size(1000, 800, P2D)
# creating the zoom variable to be able to make the zoom interactive later
global m, zoom
# setting up the initial zoom to 2
zoom = 4
# connecting the variable world with slippymapper and setting the location and zoom
m = slippymapper.SlippyMapper(39.8,-95.58306, zoom, 'carto-dark', width, height)

withLocations = []

# opening json and making processing read the titter json file by rows
with open('affordablehousing_2017-10-10_to_2017-10-16.json') as file:
for row in file:
data=json.loads(row)
geo = data['place']

# appending the tweets data in withLocations
if geo is not None:
withLocations.append(data)

# getting the latitude and langitude as separate values from the twitter file
for data in withLocations:
lon, lat = tuple(data['place']['bounding_box']['coordinates'][0][0])
print(lat,lon)

# getting the text of the tweet from the twitter file
TweetText=(data['text'])

# adding the Datamrker with the text embeded
m.addMarker(lat, lon, TweetMarker({'text':TweetText}))

m.render()

def draw():
background(255)
textSize(12)
m.draw()
textSize(18)
text('#affordablehousing tweets from 10/10 to 10/16', 50, 50)


# creating a class for the DataMarker with the text of the tweet as the data of the marker
class TweetMarker(slippymapper.DataMarker):
def drawMarker(self, x, y, marker):
txt = self.data['text']

# making the marker interactive.
if dist(x, y, mouseX, mouseY) < 7:
# setting the marker text as the tweets text and its position and color
marker.fill(255)
marker.text(txt, 12, height - 200)

marker.stroke(255)
marker.ellipse(x, y, 5, 5)


# creating the zoom interaction with the mouse
def mouseClicked():
global m, zoom
lon = m.xToLon(mouseX)
lat = m.yToLat(mouseY)


# making zoom in
if mouseButton == LEFT:
zoom += 1
# defining maximum zoom in
if zoom > 18:
zoom = 18
# making zoom out
elif mouseButton == RIGHT:
zoom -= 1
# defining maximum zoom out
if zoom < 1:
zoom = 1
m.setCenter(lat, lon)
m.setZoom(zoom)
m.render()

2. NYC Green Space Access Map Code Script

import csv
import spatialpixel.mapping.slippymapper as slippymapper
import spatialpixel.data.geojson as geojson
def setup():
size(1000, 800)

global m, zoom
zoom = 10
m = slippymapper.SlippyMapper(40.785, -73.97, zoom, 'carto-dark', width, height)


with open('Affordable_Housing.csv') as f:
reader = csv.reader(f)
header = reader.next()
for row in reader:
latitude = float(row[7])
longitude = float(row[8])
m.addMarker(latitude, longitude)
print(latitude)
m.addLayer(geojson.SlippyLayer("Open Space (Parks).geojson", strokeColor=color(38, 173, 101)))
m.render()
def draw():
textSize(18)
m.draw()

text('New York City Affordable Housing Units and Green Space Map', 50, 50)

textSize(12)
text('10/18/2017', 50, 70)

def mouseClicked():
global m, zoom
lon = m.xToLon(mouseX)
lat = m.yToLat(mouseY)


# making zoom in
if mouseButton == LEFT:
zoom += 1
# defining maximum zoom in
if zoom > 18:
zoom = 18
# making zoom out
elif mouseButton == RIGHT:
zoom -= 1
# defining maximum zoom out
if zoom < 1:
zoom = 1
m.setCenter(lat, lon)
m.setZoom(zoom)
m.render()

--

--