UNA toolbox

From TOI-Pedia

Introduction

UNAtoolbox.png

The Urban Network Analysis (UNA) toolbox is a Rhino plugin developed by the City Form Lab at MIT. It offers powerful tools to perform spatial analysis on urban street networks. This can provide useful insights for the design process. The toolbox is able to compute 5 main spatial measures: Reach, Gravity, Betweenness, Closeness and Straightness. These concepts are explained in further detail in the tutorial videos linked below.

As shown in the diagram, the toolbox requires three main inputs:

  1. lines to represent the street network
  2. origin points (e.g. representing buildings)
  3. destination points (e.g. representing public transport stops)

The purpose of this tutorial is to provide an example of how to prepare the base data in QGIS. The example focuses on data obtained from national data sources in the Netherlands. A similar method could be followed to prepare base data obtained from other sources.

The main purpose of the data preparation steps is to generate:

  • Tab-separated CSV files containing the necessary attribute data for the origin and destination points. This attribute data must include the X and Y coordinates of the points, as well as any other useful information such as the floor area or no. of people
  • A DXF file containing the street network, optionally classified by road type
Useful links:

Base data preparation

Building points

Figure 1: Importing point layer from BAG dataset
Figure 2: Creating a new field to store building function
Figure 3: Creating a new field containing address and function
Figure 4: Filtering out duplicate points [OPTIONAL]
Figure 5: Determining mean coordinates of each building point based on function
Figure 6: Calculating floor area using SQL statement
Figure 7: Joining attributes to mean coordinates layer
Figure 8: Exporting final layer as CSV file

The following section explains how to generate a tab-separated CSV file containing the X and Y coordinates and the floor area of each building point. The base data is a set of points representing each address in the Netherlands.

Data source: BAG verblijfsobject (EPSG:28992) http://www.nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/1c0dcc64-91aa-4d44-a9e3-54355556f5e7

Step 1: Extract the building points contained in the extents of the study area

  • Create a WFS connection to the data source (check the quick manuals in the QGIS tutorials if you are unsure of how to do this)
  • Add the layer containing the building points (“verblijfsobject”) to the project (making sure to only request features overlapping the view extent as shown in figure 1)
  • [Note: before adding the layer, the map canvas extent should be set to the correct location – it can be useful to use Open Street Maps or OSM place search to do this].
  • Export the new layer as a GeoPackage so that the data can be accessed offline, make sure that the “Extent” of the export is selected as “Map Canvas Extent”

Step 2: Assign a building function to each point

  • Each point already has an attribute called “gebruiksdoel” specifying its function
  • Some points may have been given multiple functions, meaning that initially the number of unique building functions may be very high
  • Use the field calculator to create a new field called “function” which simplifies the number of building functions to 8 unique values (see figure 2 and expression below)
  • [Note: to simplify the process, points with multiple functions are assigned the first function listed (e.g. if gebruiksdoel = woonfunctie, kantoorfunctie then woonfunctie is chosen as the unique building function)]

CASE WHEN "gebruiksdoel" LIKE 'woonfunctie%' THEN 'Residential' WHEN "gebruiksdoel" LIKE 'kantoorfunctie%' THEN 'Office' WHEN "gebruiksdoel" LIKE 'industriefunctie%' THEN 'Industry' WHEN "gebruiksdoel" LIKE 'winkelfunctie%' THEN 'Commercial' WHEN "gebruiksdoel" LIKE 'onderwijsfunctie%' THEN 'Education' WHEN "gebruiksdoel" LIKE 'sportfunctie%' THEN 'Sport' WHEN "gebruiksdoel" LIKE 'gezondheidszorgfunctie%' THEN 'Healthcare' ELSE 'Other' END

Step 3: Create an attribute containing the street name, house number and function

  • Distinguish points based on their address and function
  • This attribute will later be used to distinguish points with the same main address and function so that each main front door can be represented by one building point
  • Use the field calculator to create the new field (see figure 3 and expression below)

“openbare_ruimte” || ‘_’ || “huisnummer” || ‘_’ || “Function”

Step 4: [OPTIONAL] Filter out duplicate data points

  • The dataset may contain duplicate versions of some points
  • Filter out duplicate points using the “Delete duplicates by attribute” tool
  • Set the “Field to match duplicates by” to the attribute “identificatie” (the identification number of each address) (see figure 4)

Step 5: Determine the mean coordinates of each building point

  • Most buildings contain multiple points with either the same or different functions (i.e. due to different apartments in the same building or a shop below an apartment)
  • Each building’s main front door should be represented by one building point for each of the building’s function (as far as possible given the constraints of the data)
  • Use the “Mean Coordinate(s)” tool to determine the average X and Y coordinates of the points contained within the same building with the same function (see figure 5)
  • Set the “Unique ID field” as the attribute created in step 3
  • The output is a point layer with three attributes: mean X, mean Y and the combined address and function

Step 6: Calculate the floor area of each building point

  • Use the “Execute SQL” tool to determine the floor area of each of the building points (see figure 6 and expression below)
  • [Note: “RDAM_VERBLIJF_Filtered” refers to the original point layer with the additional attributes created in steps 2 and 3 (+ optionally filtered for duplicates)
  • The output of this tool is a table containing the floor area of each building point

SELECT sum(oppervlakte) as FloorArea, "Function", "Address_function" FROM RDAM_VERBLIJF_Filtered GROUP BY "Address_function";

Step 7: Join the table containing the floor area to the layer containing the mean coordinates

  • Add a join layer in the properties of the mean coordinates layer (see figure 7)
  • The join field and target field should be set as the attribute created in step 3 (called “address_function” in figure 7)
  • The floor area and function attributes should be selected from the joined fields list
  • After this step, the mean coordinates layer will contain all the information required (e.g. X coordinate, Y coordinate, floor area, function).

Step 8: Export the final output as a CSV file and change the extension to TSV

  • Before exporting, additional attributes can be created using the field calculator. For instance, the number of people can be calculated based on the average floor area per person per building function (e.g. 30m2 per person for residential buildings)
  • Export the layer as a CSV file with “TAB” separators (see figure 8)
  • Unnecessary attributes can be removed from the CSV file in Excel or QGIS (using the “Delete Field“ option in the attribute table of the layer – the changes will become visible once QGIS is closed or the layer is removed from the project)
  • Manually change the file extension from CSV to TSV (since the UNA toolbox only recognises files in TSV format)
  • Import the points to Rhino using the “Import Points” option in the UNA toolbar
  • [OPTIONAL] Create separate CSV files for each building function by filtering by the different building functions before exporting the layer

Road network

Figure 9: Importing the street network from NWB dataset
Figure 10: Field calculator expression to define new attribute “road type”
Figure 11: Incorrectly classified roads before (left) and after (right) being manually updated
Figure 12: Field calculator expression to manually update road type of selected features
Figure 13: Changing layer symbology to categorized
Figure 14: Exporting as DXF file including layer symbology

The purpose of the following steps is to extract the required street network from the base data and [optionally] assign each component with a road type for visualisation purposes.

Data source: Nationaal Wegen Bestand (EPSG:28992) http://nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/a9b7026e-0a81-4813-93bd-ba49e6f28502?tab=relations

Step 1: Extract the street network contained in the extents of the study area

  • Create a WFS connection to the data source
  • Add the layer containing the street network (called “wegvakken”) to the project (making sure to only request features overlapping the view extent) (see fig. 9)
  • [Note: before adding the layer, the map canvas extent should be set to the location of the study area]
  • Export the new layer as a GeoPackage so that the data can be accessed offline, make sure that the “Extent” of the export is selected as “Map Canvas Extent”

Step 2: [OPTIONAL] Create a new attribute called “road type”

  • Use the field calculator expression shown in figure 10 and below to define roads as either National, Regional or Local based on the rpe_code

CASE WHEN "rpe_code" is 'L' OR "rpe_code" is 'R' THEN 'National' WHEN "rpe_code" is 'N' OR "rpe_code" is 'O' OR "rpe_code" is 'W' OR "rpe_code" is 'Z' THEN 'District' ELSE 'Local' END

Step 3: [OPTIONAL] Manually edit the road type attribute of wrongly classified roads

  • Some roads may have been incorrectly classified (see example in fig. 11)
  • Select incorrectly classified roads of the same type by using the “select features by area or single click” option (multiple features can be selected using the shift key)
  • Use the field calculator to update the road type of the selected features (see fig. 12), make sure to tick the box that ensures that only the selected features are updated

Step 4: [OPTIONAL] Change the layer symbology to display the different road types

  • Change the symbology to “categorized” and classify based on the value of road type (see fig. 13)

Step 5: Export the street network as a DXF file to be used in Rhino

  • Include the layer symbology by navigating to Project > Import/Export > Export Project to DXF, set the symbology mode to “Symbol Layer Symbology” (see fig. 14)

Public transport stops

The purpose of the following steps is to create output CSV files containing the main nodes in the network of different types of public transportation (e.g. train, tram, bus, metro).

Data source: HOV-haltes (EPSG: 28992) http://nationaalgeoregister.nl/geonetwork/srv/dut/catalog.search#/metadata/DB53F555-8A93-403F-BDDD-A87815E21EBF

Figure 15: Determining the mean coordinates of each tram stop
Figure 16: Example of reducing number of stops for metro (red) and tram (blue)
Figure 17: Adding public transport points from OSM

Step 1: Extract the public transport stops contained in the extents of the study area

  • Create a WFS connection to the data source
  • Add the layer containing the stops (called “HOV_haltes”) to the project
  • [Note: before adding the layer, the map canvas extent should be set to the location of the study area]
  • Export the new layer as a GeoPackage so that the data can be accessed offline, make sure that the “Extent” of the export is selected as “Map Canvas Extent”

Step 2: Create a layer for each mode of public transportation

  • For instance, create a separate layer for bus, metro, tram and train
  • Filter by the attribute containing the public transport types (by right clicking on the layer and selecting “Filter”), use an expression similar to the one shown below
  • After filtering, export the layer as a GeoPackage
  • Repeat for all modes of public transportation

“route_vervoermiddel” = ‘bus’

Step 3: [OPTIONAL] Reduce the number of points associated with each stop

  • The dataset often contains multiple points for the same stop (e.g. due to stops on different sides of the road), reduce the number of points to (ideally) one per stop
  • Use the “mean coordinate(s)” tool with the “Unique ID field” set to the attribute containing the stop name (see fig.15)
  • See fig. 16 for an example of how the tool reduces the number of points per stop


Step 4: Export the point layers as tab-separated CSV files to be used in Rhino

  • Use the same settings as shown in fig. 8 to export the layers
  • Import the points into Rhino using the “Import Points” option in the UNA toolbar (ensure that the file extension is changed to TSV)

Alternative data source: Open Street Maps, public_transport point layer - Add the public_transport point layer by using the QuickOSM plugin - Navigate to Vector > Quick OSM > Quick OSM - Enter ‘public transport’ as the key and choose the location of the study area (see fig. 17) - Remove the automatically added polygon and line layers from the project - Follow a similar method to steps 2-4 outlined above

Personal tools
Actions
Navigation
Tools