Tutorial 4 — Network Analysis
Published in
3 min readFeb 23, 2022
This tutorial builds on the script from Tutorial 3 — Working with Spatial Data. You can download the based script from Tutorial 3 or explore the completed script below.
Performing Network Analysis in Grasshopper
Installing Decoding Spaces Toolbox
- Navigate to the Decoding Spaces Toolbox home page and down the plugin.
- Navigate to the folder where the plugin is downloaded. You should see a .zip file. Right-click on the zip file and open the properties window. Make sure that the “Unblock” checkbox is checked. It is very important to “unblock” the zip file before extracting the folder to install the plugin successfully.
- Next, lets access the Grasshopper Libraries folder. Launch Rhino and Grasshopper, and in the “File” menu dropdown select “Special Folders” and “Components Folder”. This should open up the Libraries folder in your local computer.
- Alternatively, you can access the folder via the folder address below:
C:\Users\"Your User Name"\AppData\Roaming\Grasshopper\Libraries
- Copy the unzipped Decoding Spaces folder into the Libraries folder. Restart Rhino and Grasshopper and you should see that Decoding Spaces Toolbox has been added to Grasshopper.
- To install any other plugins, follow the same instructions.
Cropping Street Network
- Lets continue our progress from Tutorial 3, where we successfully imported building footprints and street networks from OpenStreetMap.
- As we’ve learned, spatial network analysis starts from a Graph. Since an city graph can be extremely large and resource-intensive, we will start by cleaning and cropping the street network.
- In Grasshopper, turn off the Custom Preview except for the street network. This allows us to see the network more clearly.
- In Rhino, draw a rectangle to define the extent of the street network that we would like to use. Draw something that encompasses around 20–30 blocks.
- In Grasshopper, place a “Curve” component onto the canvas and reference the rectangle that we’ve drawn. Then, connect the referenced curve into the “Crop” input of the ImportOSM component used to build the street network.
- The script should update and the imported street network now cropped to the extent of the rectangle.
Process Geometry
- Next, we need to rebuild our street network. Since a graph is constructed using only Lines and Nodes, we must ensure that our street network contains only straight lines and split at every intersection.
- Luckily, we’ve already perform the Split Streets operation in the last tutorial. So all there’s left is to rebuild the network into lines.
- Place a Rebuild Curve component, and connect the curve outputs from Split Streets into the Curve input.