- Run OSmnx in Jupyter Notebook. Please google for Professor Boeing’s examples for how to download and run Jupyter Notebook.
- In this step we download a street network from Open Street Map to OSmnx then we save the network as a shape file.
Copy this piece into Jupyter notebook
import geopandas as gpd
import momepy
import pandas as pd
import networkx as nx
import osmnx as ox
import matplotlib.pyplot as plt
# in this method we define the boudnary
of an area and then draw a street network from it
# First we need to load the neighborhood
shapefile
# draw a boundary from this address:
http://geojson.io/#map=13/24.4209/54.5849 Thank you #GEOJSON!
# we define neighborhood shapefile for
example khalifa.shp. Remember to change to your own #path!
neighborhood = gpd.read_file('danang1')
neighborhood.head()
polygon = neighborhood['geometry'].iloc[0]
print (polygon)
# then we define a graph based on the
polygon that we have
# we will use the abreviation, our rule is
the first three words
G = ox.graph_from_polygon(polygon,
network_type='drive', simplify = False)
G_projected = ox.project_graph(G)
fig, ax = ox.plot_graph(ox.project_graph(G), filename= 'test1', dpi = 1200,
file_format='png', save=True,node_size=0)
# save street network as ESRI shapefile to
work with in GIS
ox.save_graph_shapefile(G,
filename='danang1_shape')
3.
As a result we have the shape file. Next step we
need to convert this shape file to DXF.
4.
Open QGIS (If you don’t have a QGIS, please
download. It is pretty straightforward to I don’t think you have any problems).
Layer à
Add Layter à
Add vector layer
Find Source, click to three dots button …
Find the location of the shape file. Here we need a street network so we select edges.shp5. Last step is export the shape file to dxf.
Project à Import/Export à Export Project to DXF
Pay attention to the location of the dxf file location!
APPENDIX
This section will tell you how to use the boundary area to load the network into OSmnx.
1. Open geojson.io
2. Click Draw a polygon
Save à Shapefile






Không có nhận xét nào:
Đăng nhận xét