In [1]:
import osmnx as ox
%matplotlib inline
ox.config(log_file=True, log_console=True, use_cache=True)
In [2]:
place = 'Piedmont, California, USA'
In [3]:
gdf = ox.gdf_from_place(place)
gdf.loc[0, 'geometry']
Out[3]:
In [4]:
# save place boundary geometry as ESRI shapefile
ox.save_gdf_shapefile(gdf, filename='place-shape')
In [5]:
G = ox.graph_from_place(place, network_type='drive')
G_projected = ox.project_graph(G)
In [6]:
# save street network as ESRI shapefile
ox.save_graph_shapefile(G_projected, filename='network-shape')
In [7]:
# save street network as GraphML file
ox.save_graphml(G_projected, filename='network.graphml')
In [8]:
# save street network as SVG
fig, ax = ox.plot_graph(G_projected, show=False, save=True,
filename='network', file_format='svg')
In [9]:
G2 = ox.load_graphml('network.graphml')
fig, ax = ox.plot_graph(G2)
In [10]:
gdf = ox.buildings_from_place(place='Piedmont, California, USA')
gdf.drop(labels='nodes', axis=1).to_file('data/piedmont_bldgs')
In [ ]: