Photographing great streets of L.A. from a survey while using Data Analysis

SANTA-MONICA street sign

In my quest to learn about Los Angeles as a whole, I have been thinking about street photography, and I have been looking into working in data analysis. This led me to ‘Great Streets Pedestrian Survey’. The data wasn’t so large but I plan to take some street photography at these neighborhoods.

Tools and equipment used

Data Analysis 📈 Data Analysis 📈 Camera 📷
Konica FC-1
Hexanon AR 40mm f/1.8
Olympus XA
Zuiko 38mm f/2.8
Pentax Spotmatic
SMC A 20mm f/2.8
SMC A 150mm f/2.8
SMC A 50mm f/1.8
Fuji X-T20
FUJINON XC 15-45mm f/3.5-5.6 OIS PZ

Download great streets pedestrian survey at data from data.gov or data.lacity.org

Data wrangling and cleaning was important to provide geo coordinates. https://github.com/ykimdeveloper/DATA-WRANGLING-Great-Streets-Survey-ykimdeveloper

Great Streets Pedestrian Survey

Generated by wpDataTables

The City of Los Angeles conducted a pedestrian survey with the purpose of identifying residents’ concerns and accessibility in the City. The survey was first conducted in 2015 and the data was last updated on November 30, 2020. In addition, you can download the original data csv on their website data.lacity.org and the data wrangled dataset.

💡Tip! Click or zoom in the number markers! Top map is built with Folium

The geolocations were obtained by using the APIs provided by Google Maps. The latitude and longitude from the street had to be cleaned and converted to ordinal values, i.e. 41 to 41st.

https://github.com/ykimdeveloper/MAPS-Great-Streets-Survey-ykimdeveloper

Bottom map is built with ArcGis

💡Tip! Click on the bar graph, double click to reset. Landscape view is optimal. Plotly chart

Out of the 421 pedestrians, %12 are people who are shopping. In Santa Monica area (90066), 57% of pedestrians shop very often $10-30.

Power BI graph
Power BI graph

The graph above is of Hollywood (90028) and meeting friends and going out is quite high.

💡Tip! Pie chart for Landscape view only on phones. Click on the legend to remove for a different overall percentage!

This survey would assume most pedestrians in Los Angeles do not drive but take public transport. If you were to remove cars, 44.2% are walking to their destination and 44.4% take the bus.

Python Code

Pie Chart

import plotly.express as px

pie_fig = px.pie(chart_data_sorted_df,
     values=y_axis, 
     names=x_axis, 
     color_discrete_sequence=px.colors.sequential.Emrld)

pie_fig.update_layout(
        font=dict(color='#8a8d93'),
        title={
            'text': "How do you typically get to this neighborhood?",
            'y':.95,
            'x':0.55,
            'xanchor': 'center',
            'yanchor': 'top'},
        font_family="Courier New",
        title_font=dict(size=17, color='#a5a7ab', family="Courier New"),
        paper_bgcolor='#2D3035',
        plot_bgcolor='rgba(0,0,0,0)'
)

pie_fig.update_traces(marker = dict( line=dict(color='#000000', width=2)))

pie_fig.show()
pie_fig.write_html("piechart.html")

Extracting values from a string sentence and making new features.


question = "I Live Here, Passing through en route to somewhere else, To meet friends, To dine / drink, To shop"
find= 'to dine'
find_no_punct = re.sub(r'[^\w\s]', '', find)
question_no_punct = re.sub(r'[^\w\s]', '', question)

find_words = find_no_punct.lower().split()
question_words = question_no_punct.lower().split()


result=[word for word in find_words if word in question_words]

Creating Geo Coordinates (latitude, longitude) from street names.

def geo_street(street_01, street_02):
    parameters = {"address": street_01+" and " + street_02 +", Los Angeles",
              "key": AUTH_KEY}

    r = requests.get(f"{base_url}{urllib.parse.urlencode(parameters)}")
    
    data = json.loads(r.content)
    if data['status'] == 'OK' and  data['results'][0]['geometry']['location_type'] == 'GEOMETRIC_CENTER':
        lat = data['results'][0]['geometry']['location']['lat']
        lng = data['results'][0]['geometry']['location']['lng']
        formatted_address = data['results'][0]['address_components'][0]['long_name']
        geo_type = data['results'][0]['geometry']['location_type']
        zipcode = data['results'][0]['address_components'][6]['long_name']
        area = data['results'][0]['address_components'][1]['long_name']
    elif  data['status'] == 'OK' and  data['results'][0]['geometry']['location_type'] == 'APPROXIMATE':
        lat = data['results'][0]['geometry']['location']['lat']
        lng = data['results'][0]['geometry']['location']['lng']
        formatted_address = data['results'][0]['address_components'][0]['long_name']
        geo_type = data['results'][0]['geometry']['location_type']
        zipcode = np.nan
        area = data['results'][0]['address_components'][1]['long_name']
    elif data['status'] == 'ZERO_RESULTS':
        lat = np.nan
        lng = np.nan
        formatted_address = np.nan
        geo_type = np.nan
        zipcode = np.nan
        area = np.nan
        
    return lat, lng,formatted_address, zipcode, geo_type, area