Recently I discovered Geoff Boeing’s amazing OSMnx Python package. It’s an extremely useful tool and very well documented. Geoff used originally used his tool to compare city street grids. I decided to use it to compare college campuses. I started with alma mater.

And our biggest rival.

One really cool feature of OSMnx is you can maintain scale when plotting and saving maps. This makes it really easy to compare the relative sizes of different campuses.

But why stop at just two schools? Here are comparisons of all the schools in the ACC, Big 10, Big 12, Pac-12, and SEC.

And here are all the individual campuses.

I plan on generating more maps of more schools, but if you want to do it yourself here’s the code I used.

import osmnx as ox, matplotlib.pyplot as plt from descartes import PolygonPatch from shapely.geometry import Polygon, MultiPolygon ox.config(log_console=True, use_cache=True) import geopandas as gpd def generate_campus_map(campus_name,result_to_use,background_color,accent_color): # get the place shape campus = ox.gdf_from_place(campus_name,which_result=result_to_use) gdf = ox.project_gdf(campus) polygon = campus['geometry'].iloc[0] buildings = ox.create_buildings_gdf(polygon) buildings_proj = ox.project_gdf(buildings) G = ox.graph_from_place(campus_name,which_result=result_to_use,simplify=True,network_type='all', retain_all=True) G = ox.project_graph(G) west, south, east, north = gdf.unary_union.bounds # plot the network, but do not show it or close it yet fig, ax = ox.plot_graph(G,show=False, close=False, edge_color=accent_color,node_size=0,edge_linewidth=0.25,fig_height=(north-south)/500) # to this matplotlib axis, add the place shape as descartes polygon patches for geometry in gdf['geometry'].tolist(): if isinstance(geometry, (Polygon, MultiPolygon)): if isinstance(geometry, Polygon): geometry = MultiPolygon([geometry]) for polygon in geometry: patch = PolygonPatch(polygon, fc=background_color, ec=accent_color, linewidth=1, alpha=1, zorder=-2) ax.add_patch(patch) for geometry in buildings_proj['geometry'].tolist(): if isinstance(geometry, (Polygon, MultiPolygon)): if isinstance(geometry, Polygon): geometry = MultiPolygon([geometry]) for polygon in geometry: patch = PolygonPatch(polygon, fc=accent_color, ec='none', linewidth=.05, alpha=1, zorder=1) ax.add_patch(patch) ax.set_ylim((south, north)) ax.set_xlim((west, east)) plt.show() plt.savefig(campus_name+'.svg',format='svg',bbox_inches='tight') plt.savefig(campus_name+'.png',format='png',dpi=300,bbox_inches='tight',pad_inches = 0)