Quantifying Walkability: Assessing Network Density

In this section, we introduce a function that calculates both the total area of the defined boundary polygon and the network density.


Calculating Area and Network Density

The following Python function, get_network_density(hull_temp_gdf, total_length_km), takes the boundary GeoDataFrame (hull_temp_gdf) and the total length of the pedestrian network in kilometers (total_length_km) as inputs. Let's unravel the code:


# Calculate the area of the boundary polygon in square kmeters
def get_network_density(hull_temp,total_length_km):
	hull_temp_gdf = hull_temp.copy()
	hull_gdf_projected = hull_temp_gdf.to_crs(epsg=32748)  # Reproject to EPSG:32748
	area_square_meters = hull_gdf_projected.geometry.area.sum()
	# Convert to square kilometers
	area_square_km = area_square_meters / 1e6  # 1 square kilometer = 1,000,000 square meters
	print(f"Total area of my boundary (sq km): {area_square_km}")

	network_density = total_length_km / area_square_km
	print(f"Total network density (km  of network per sq. km): {network_density}")

	return area_square_km, network_density


gdf_area_square_km, gdf_network_density=get_network_density(gdf,G_total_length_km)
gdf_area_square_km, gdf_network_density=get_network_density(gdf,G_total_length_km)


Total area of my boundary (sq km): 665.0817761561453
Total network density (km  of network per sq. km): 40.87665691146178

Understanding the Function


Reprojection: The boundary GeoDataFrame is reprojected to EPSG:32748 to ensure accurate area calculations. 
This step is crucial for maintaining precision when working with geographical data. 

Area Calculation: The total area of the boundary polygon is computed in square meters. 

Conversion: The area is then converted to square kilometers for more intuitive and standardized metrics. 

Network Density: The network density is determined by dividing the total length of the pedestrian network 
by the area of the boundary polygon. This metric represents the density of walkable pathways per square kilometer. 

Insights into Walkability

Network density provides valuable insights into the concentration of walkable routes within the city's defined limits.