This section explains the basic built-in functionalities pertaining to urban graph analysis.
The two principal elements of an urban graph are vertices and edges. Generally, a vertex corresponds to the intersection of mutiple edges. In Urban Planning, vertices correspond to intersection points, and edges correspond to linear road data.
There is an extensive collection of scholarly articles pertaining to graph theory with concrete GIS applications:
- J.K.Tinkler (1977) 
- A.G.Bunn, D.L.Urban & T.H.Keitt (2000) 
- E.Dobrzyńska & M.Dobrzyński (2016) 
A real urban graph is derived from road data. It follows the existing street pattern to fit with the physical reality of the terrain.
This type of data is usually found online, in open access from official sources or from open-source.
T4QG relies on metric Cartesian coordinates for a few of its functionalities. Open the
.proj file connected to your data and check in what type it is currently projected.
If your original data is in lat/lon, you can find the metric alternative on https://epsg.io
Open your data a first time, and save it under the correct metric projection (SCR). Check your new
.proj file to confirm changes.
>>> roads = QgsVectorLayer('~/roads.shp', 'roads', 'ogr') >>> QgsMapLayerRegistry.instance().addMapLayer(roads)
You may find more information concerning Loading Vectorial Datasets in Qgis at the official documentation page.
To extract intersection nodes from lineStrings:
Parameters: layer (QgsVectorLayer) – a LineString vector layer. Returns: A Vector Layer wherein points are created at each intersection of more than two LineStrings of the input layer.
An alternative method for creating an urban graph may also be built using the surrounding urban morphology.
This process, called skeletonization, requires a layer of polygons representing the built form.
To learn how to build the skeleton of the built environment, head to the page on Creating Geometries.
To clean the linestring data before processing :
Parameters: layer (QgsVectorLayer) – a LineString vector layer. Returns: A Vector Layer wherein the input linestrings are joined when they intersect a single other linestring, and split at the intersection of more than two linestrings.
>>> roads = STSkeletonizeTheVoid(buildings_ExtRing).execute() >>> nodes = STToRoadsSectionsNodes(roads).execute() >>> QgsMapLayerRegistry.instance().addMapLayer(nodes)
>>> roads = STSkeletonizeTheVoid(buildings_ExtRing).execute() >>> segmentNodes = STToRoadsSections(roads).execute() >>> nodes = STToRoadsSectionsNodes(segmentNodes).execute() >>> QgsMapLayerRegistry.instance().addMapLayer(nodes)