Analyzing city street maps using Python plots and network metrics

Sejal Dua

Towards Data Science

The Intersection of Geocoding and Art with Open Street Map and Networkx | by Sejal Dua | Jan, 2024 - image  on https://aiquantumintelligence.com
Photo by Logan Armstrong on Unsplash

I could go on for hours in an attempt to persuade a group of people why my city (New York) is the best city in the world. However, I have recently realized that our perception of cities varies according to our own internal evaluation criteria. Cities can be evaluated across a multitude of facets, including weather, food scene, nightlife, attractions, walkability, bike-ability, quality of public transit, sports teams, access to nature, etc.

In a recent discussion with some colleagues and friends, some expressed that ease of transportation should be more heavily weighted than weather, while others countered that they could get past a bitter wind chill as long as there were plenty of things to do. Ranking or tiering cities is a highly subjective exercise, partially due to the ambiguity of the factors that should be considered, but also because cities can be evaluated from different contexts: to live in, to visit for a weekend, or to visit for a week. Personally, having lived in four cities in my life, I have learned that even my own ranking of cities changes slightly as my priorities fluctuate. For example, I rank Boston more highly as a place to live than to visit, whereas I rank Miami more highly as a place to visit than to live.

One major shortcoming that comes up as part of the debate is how to rank cities you’ve never been to before. This particular blocker motivated me to better understand cities from the angle of learning how they are laid out on a map. All top tier cities that I have come across have a body of water (e.g. river, ocean, lake) in close proximity to the city center, so I wanted to verify if this is a common feature of all metropolitan cities. As for whether the downtown part of a city is typically configured in a square grid or randomly arranged, this question led me to leverage the Open Street Map API programmatically.

In this technical walkthrough, I will primarily present my findings of this exploration but also briefly explain how I implemented the Python code.

Step 1: Geocoding



Source link