Submit the following programs via the honors section of Gradescope:
Throughout the semester, we will focus on the upcoming expansion of CitiBike:
The de Blasio Administration joined Lyft to today announce the boundaries of the planned expansion of Citi Bike over the next five years, which will bring the nation's largest bike share system to a larger and more economically diverse range of communities. Last November, the City and Lyft announced an agreement in which Lyft would invest $100 million to grow and strengthen the system, doubling the size of its service area and tripling the number of bikes over the next five years. The third phase of Citi Bike's expansion will bring Citi Bike to all of Manhattan, as well as into the Bronx, and deeper into Brooklyn and Queens.and how best to allocate the new bicycles to the next targeted neighborhoods in the South Bronx, Upper Manhattan, and Queens.
To begin, pick a neighborhood (i.e. choose one and sign up on Blackboard). Create a single page summary of your neighborhood that includes:
Note: upload a .pdf to the assignment HC 1. in the honors section of Gradescope. Unlike the Python code, it is not automatically graded.
Working in pairs or triples, design a ranking for most desirable features of a neighborhood.
There are multiple rankings of New York City Neighborhoods. For example,
Submit a .pdf file containing your assessment of the rankings and the three most desirable qualities. You should use complete sentences, compare and contrast the rankings above, and justify the three qualities that your group thought most important.
Urban planner, Jeff Speck, argues that if a city succeeds at being walkable (and by extension, bikeable), it excels at having a high quality of life (see his TED talk).
Working in pairs or triples, analyze his argument in terms of five neighborhoods in New York City and the ranking you determined in HC 2. For five of the neighborhoods chosen by class (1-page summaries from HC 1 are available on Blackboard), determine the following:
Does your ranking concur with ranking the neighborhoods by walkability? Justify your answer.
Submit a .pdf file analyzing the your rankings and walkability of five neighborhoods chosen for the class. You should use complete sentences and justify your answers with data.
FiveThirtyEight analyzed the cost of commuting in terms of the extra New Yorkers were willing to pay to lessen their commute. StreetEasy did a similar analysis, measuring from given subway stops (and includes a lovely Tableaux map-- scroll down).
How will availability of CitiBikes affect housing prices? To narrow down the analysis, we will focus on the distance to two landmarks: Empire State Building (as a proxy for midtown) and Federal Hall (for the financial district) and 3 locations. You may find WNYC Transit Time or Google Maps useful, as well as CityMapper. Pick, at random, three rentals in your neighborhood.
Using the analysis from FiveThirtyEight, predict what the tunnel closure will do to the prices of your three chosen apartments. Justify your answer.
Submit a .pdf file analyzing the time and cost of commuting of your neighborhood. You should use complete sentences and justify your answers with data.
For this program, we will create a highlighted map around centered on your neighborhood, with the region within about a 1/4 mile box at full brightness, the region that outside that box at 50% brightness.
To do this:
Submit your answer as a .pdf file to gradescope.
To determine where to place new bike stations, the NYC Department of Transportation, divided each region into 1000-square-foot grid (see p 25 of the NYC Bike Share Report for a sample grid).
Take an image of your neighborhood and overlay it with a 1000 square-foot grid.
To do this:
Your answer should have your image on the first page and the code you used to generate the image on the next page. Submit your answer as a .pdf file to gradescope.
(Workshop Table Graphic, NYC Bike Share Report, p 26.)
Where should bike stations go in your neighborhood? The criteria outlined in the NYC Bike Share Report aimed to have at least one station per every 1000-square-feet and be near destinations such as train/bus stops, museums, shopping, and parks (see graphic above).
Identify 3-5 possible locations that would be a good location for a bike station in each grid location (include the cross streets or short description if mid-block, as well as which side-- such as "north east corner of the intersection") and a short justification of why that location would be good.
Your answer should contain your grid (from HC 6) and a itemized list with an entry of the locations for each region in the grid.
Submit your answer as a .pdf file to gradescope.
Using the geoJSON mapper (see geoJSON notes), make a JSON file that includes the following features:
Commit to github, and view using the github preview button (you should see you encoding rendered graphically on a map).
Submit a screenshot of your map as a .pdf file.
We are going to be using github to make webpages for your projects. There will be only one final site for each team, but we want everyone to set up their own page as a warm-up exercise.
Create a github page for your neighborhood.
Submit a .pdf file that contains the URL of your project on github (web address) and a screenshot of your webpage.
The honors section will have final presentations on 6 December, addressing, the Expansion of CitiBike:
In particular,
You will work with your team to develop your presentation, which has 2 parts:
For this group assignment, include in a .pdf file:
New York City's bike share program, CitiBike, provides extensive data about their system.
The data is stored in the JSON format. In addition to directly reading in CSV files, Pandas has a built-in function for reading in JSON files.
Citibike includes a real-time feed of the status of stations in the system.
The feed is in JSON. Here's the beginning of the file:
It begins with the time the file was created, followed by information about each station in a field marked stationBeanList. Each entry is organized as dictionary with (key:value) pairs. Let's look at the bean list entry for the first station:
Which ones are useful for making a map? We need latitude and longitude. For our popup message, it would also be good to give location as well as the number of bikes available and number of docks. If we called the stationBeanList entry for a station, beanList, these entries would be:
To build our map, we need to:
The new part is reading in a json file, but pandas has a built-in method to do that for us: read_json():
The second step, creating a map object, is the same as before:
Extracting the information from each row has an added level, since the information is stored in the dictionary, stationBeanList. To make the lines more readable, we will save row['stationBeanList'] as the variable beanList. The rest of the for is the same as previous prorgrams:
Putting this altogether gives the python program, cbStations.py.
Note: You can directly read from a URL, as we did in this program, or if you would like to work off-line, you can download the JSON file, save it locally, and use it as before.
Modify the program in the following way:
Submit a .pdf that contains a screenshot of your map on the first page and the Python program that produces it on the next page.
A Voronoi diagram divides a region based on the distance to a set of input points. This simple idea has many applications, one of the most famous was the work of John Snow to study the 1854 cholera outbreak. Our focus will be on mapping current and proposed CitiBike stations.
The sample program builds a Voronoi diagram for the existing CitiBike stations.
The map highlights the regions closest to each station:
To make our map, we
If you are using anaconda (either spyder, idle3, or jupyter), the scipy and matplotlib packages are included. To install geojson, type at a terminal window:
The program, makeVorBikes.py, is a bit rambling, but contains all the steps above (a better design would be to split into separate functions or files for the different tasks).
Try running it. Note that it does very well in dense regions but has odd behavior on the edges of the map since we didn't include in the .json file any point at infinity and didn't clip the maps to the city boundaries.
Modify the program as follows:
Run the program now and observe how your proposed bike stations cover your neighborhood.
Submit a .pdf file with the name of your neighborhood and a screen capture image of the HTML map generated with your modifications on the first page and a copy of your modfied program on the second page.
Submit the URL of your group webpage poster/presentation as part of a .pdf file. If you have plans to add more to the website, include in the .pdf file any changes you have planned but didn't have a chance to enter yet.
Feedback Forms will be passed out and returned in section on November 29.
Each team will review and comment the other teams' slides and webpage by filling out fdeedback forms.
After you have commented on others' group presentations, we will distribute the forms so that groups can use these to improve their slides and webpages for the final presentation on December 6.
Submit the revised slides of your group presentation (two slides total) as a .pdf file. Your slides should include who is on the team, the neighborhood you chose, and a brief description of your proposed citibike expansion and how it will affect your neighborhoods.
The de Blasio Administration joined Lyft to today announce the boundaries of the planned expansion of Citi Bike over the next five years, which will bring the nation's largest bike share system to a larger and more economically diverse range of communities. Last November, the City and Lyft announced an agreement in which Lyft would invest $100 million to grow and strengthen the system, doubling the size of its service area and tripling the number of bikes over the next five years. The third phase of Citi Bike's expansion will bring Citi Bike to all of Manhattan, as well as into the Bronx, and deeper into Brooklyn and Queens.
Focusing on the expansion in three different boroughs, will the presence of CitiBike significantly affect residents' commute?
{"executionTime":"2017-03-21 10:37:12 PM",
"stationBeanList":[
{"id":72,"stationName":"W 52 St & 11 Ave","availableDocks":18,"totalDocks":39,"latitude":40.76727216,"longitude":-73.99392888, "statusValue":"In Service",
"statusKey":1,"availableBikes":19,"stAddress1":"W 52 St & 11 Ave","stAddress2":"","city":"","postalCode":"","location":"","altitude":"","testStation":false,
"lastCommunicationTime":"2017-03-21 10:36:30 PM","landMark":""},
{"id":79,"stationName":"Franklin St & W Broadway","availableDocks":31,"totalDocks":33,"latitude":40.71911552,"longitude":-74.00666661,"statusValue":"In Service",
"statusKey":1,"availableBikes":0,"stAddress1":"Franklin St & W Broadway","stAddress2":"","city":"","postalCode":"","location":"","altitude":"","testStation":false,
"lastCommunicationTime":"2017-03-21 10:33:23 PM","landMark":""},
{"id":82,"stationName":"St James Pl & Pearl St","availableDocks":23,"totalDocks":27,"latitude":40.71117416,"longitude":-74.00016545,"statusValue":"In Service",
"statusKey":1,"availableBikes":4,"stAddress1":"St James Pl & Pearl St","stAddress2":"","city":"","postalCode":"","location":"","altitude":"","testStation":false,
"lastCommunicationTime":"2017-03-21 10:34:12 PM","landMark":""},
{"id":72,
"stationName":"W 52 St & 11 Ave",
"availableDocks":18,
"totalDocks":39,
"latitude":40.76727216,
"longitude":-73.99392888,
"statusValue":"In Service",
"statusKey":1,
"availableBikes":19,
"stAddress1":"W 52 St & 11 Ave",
"stAddress2":"",
"city":"",
"postalCode":"",
"location":"",
"altitude":"",
"testStation":false,
"lastCommunicationTime":"2017-03-21 10:36:30 PM",
"landMark":""}
beanList['latitude']
beanList['longitude']
beanList['name']
beanList['availableBikes']
beanList['totalDocks']
stations = pd.read_json('https://feeds.citibikenyc.com/stations/stations.json')
mapBikes = folium.Map(location=[40.75, -73.99],tiles="Cartodb Positron",zoom_start=14)
for i,row in stations.iterrows():
beanList = row['stationBeanList']
lat = beanList['latitude']
lon = beanList['longitude']
name = beanList['stationName'] + ": " + str(beanList['availableBikes']) + " bikes available of " + str(beanList['totalDocks']) + " total bikes"
print(name)
if beanList['statusValue'] == 'Not In Service':
name = beanList['stationName'] + ": Not In Service"
i = folium.Icon(color='lightgray')
else:
name = beanList['stationName'] + ": " + str(beanList['availableBikes']) + " bikes available of " + str(beanList['totalDocks']) + " total bikes"
if beanList['availableBikes'] < 2:
i = folium.Icon(color='red')
else:
i = folium.Icon(color='green')
folium.Marker([lat,lon],popup = name,icon = i).add_to(mapBikes)
#Create the html file with the map:
mapBikes.save(outfile='bikeLocations.html')
Hint: compute the percentage and then add it to your message-- remember to cast/convert it to string.
pip install geojson