Skip to content

Instantly share code, notes, and snippets.

@simrit1
Forked from MaxvanHaastrecht/street_map.py
Created January 24, 2022 05:39
Show Gist options
  • Select an option

  • Save simrit1/3b154d66db27e710662de05a9c6a3987 to your computer and use it in GitHub Desktop.

Select an option

Save simrit1/3b154d66db27e710662de05a9c6a3987 to your computer and use it in GitHub Desktop.
Importing roads and plotting as a city street map
import geopandas as gpd
import matplotlib.pyplot as plt
# Import all roads NL
map_df = gpd.read_file('roads.shp')
# Show data format
map_df.head()
# Set image properties
fig, ax = plt.subplots(1, figsize=(10,14))
map_df.plot(cmap='Wistia', ax=ax)
ax.axis('off')
# Set coordinates to match Utrecht, change for your own city
ax.set_xlim(5.1050, 5.1400)
ax.set_ylim(52.0620, 52.1115)
ax.set_aspect('equal')
# Plot the street map of Utrecht
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment