This part aims to push further with the analysis of spatial distribution of arts and cultural amenities and look at their accessibility. Due to the limited scope of this project, the analysis may not involve the whole existing dataset, but rather, a small part of data is used for demonstrating purpose.
Code
# Packagesimport xarray as xrimport hvplot.pandas # noqaimport hvplot.xarray # noqaimport cartopy.crs as ccrsimport pandas as pdimport numpy as npimport altair as altimport geopandas as gpdimport hvplot.pandasimport numpy as npimport pandas as pdimport seaborn as snsfrom matplotlib import pyplot as pltimport datetimeimport math%matplotlib inlineimport plotly.express as pxfrom plotly.offline import init_notebook_mode, iplotimport plotly.graph_objects as gofrom plotly.subplots import make_subplotsimport osmnx as oxfrom shapely.ops import unary_unionimport panel as pn
Given metro and tube (the subways) are one of the most common modes of traveling in NYC and London, the first section is to look at to what extent do cultural infrastructure falls in walkable distance from a metro or tube station. The NYC dashboard shows the amenities that are located within 2-minute, 5 minutes, and 10-minute walkshed buffering, and the London one on the other hand shows 5-minute, 10 minutes, and 15-minute buffers. This decision is made partially due to the fact that the Greater London area is a lot larger than NYC. We can see that most NYC amenities falls within the 10-minute walking buffer and most London ones fall within 15-minute buffer, showing their great accessibility
buffers_london = ['Buffer_5_min', 'Buffer_10_min', 'Buffer_15_min']bufferSelect_london = pn.widgets.Select(value='Buffer_5_min', options=buffers_london, name="Buffer")# plot data on a mapdef plot_galleries(data, selected_buffer): m = data.explore(column='value', tiles='Carto DB Positron')return m# Create Dashboarddef create_dashboard_London(selected_buffer): galleries = London_art_melt.loc[London_art_melt['Buffer'] == selected_buffer] m = plot_galleries(galleries, selected_buffer)return pn.pane.plot.Folium(m, height=700) dashboard_London = pn.Column( pn.Column("Subway Walking Distrance to Galleries, London", bufferSelect_london), pn.Spacer(height=30), pn.bind(create_dashboard_London, selected_buffer=bufferSelect_london))
Code
dashboard_London
2. OSM network Analysis of NYC
Another potential way to judge their accessibility to outside travelers is through OSM network analysis. Here, I’m using JFK airport and the cultural centers in Manhattan as an example. Since most people travel via metro within the city, and only a good number of tourists traveling from the airport drives or take uber to travel into the city, it makes the most sense to have JFK airport as the node of origin and accessing accessibility of all amenities from the airport. The result is shown in the table. However, the result of calculation might be a bit off, considering NYC’s traffic condition….
NYC_museums_manhattan = NYC_museums_manhattan[['Name', 'Address', 'geometry']]NYC_museums_manhattan = NYC_museums_manhattan.loc[NYC_museums_manhattan['Name'] !='Ellis Island Museum']NYC_museums_manhattan = NYC_museums_manhattan.loc[NYC_museums_manhattan['Name'] !='American Immigration History Center']
Code
convert to crs with meters - .geometry.distance (from JFK)
Code
# impute speed on all edges missing datagraph = ox.add_edge_speeds(graph)# calculate travel time (seconds) for all edgesgraph = ox.add_edge_travel_times(graph)
Code
def calculate_distance(row): destination_point = row['geometry']# Find the nearest nodes on the graph for the airport and destination points orig_node = ox.distance.nearest_nodes(graph, jfk.geometry.x, jfk.geometry.y) destination_node = ox.distance.nearest_nodes(graph, destination_point.x, destination_point.y)# Initialize airport_node for each row airport_node = ox.distance.nearest_nodes(graph, jfk.geometry.x, jfk.geometry.y)# Initialize variable shortest_travel_time =None# Check if there is a path before calculatingif nx.has_path(graph, airport_node, destination_node): shortest_travel_time = nx.shortest_path_length(graph, airport_node, destination_node, weight='travel_time')return shortest_travel_time# Assuming jfk is the airport information for the first rowjfk = jfk.iloc[0]# Apply the function to calculate shortest travel time for each rowNYC_museums_manhattan['shortest_travel_time'] = NYC_museums_manhattan.apply(calculate_distance, axis=1)
Code
NYC_museums_manhattan['shortest_travel_time (in Minute)'] = NYC_museums_manhattan['shortest_travel_time'] /60