Ressources numériques en sciences humaines et sociales OpenEdition Nos plateformes OpenEdition Books OpenEdition Journals Hypothèses Calenda Bibliothèques OpenEdition Freemium Suivez-nous

Creating Graphs

Creating Graphs

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) [1]
  • A.G.Bunn, D.L.Urban & T.H.Keitt (2000) [2]
  • E.Dobrzyńska & M.Dobrzyński (2016) [3]

Downloading Data

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.

Extracting Nodes

To extract intersection nodes from lineStrings:

STToRoadsSectionsNodes(layer).execute()
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.

The lineString layer returned by STSkeletonizeTheVoid() needs to be joined using STToRoadsSections() to extract the intersections correctly.

To clean the linestring data before processing :

STToRoadsSections(layer).execute()
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)
http://mau.hypotheses.org/files/2017/12/roadsSectionsNodes_bad.png

Because the lineStrings are not joined, intersections are found at each segment extremity.

>>> roads = STSkeletonizeTheVoid(buildings_ExtRing).execute()

>>> segmentNodes = STToRoadsSections(roads).execute()

>>> nodes = STToRoadsSectionsNodes(segmentNodes).execute()

>>> QgsMapLayerRegistry.instance().addMapLayer(nodes)
http://mau.hypotheses.org/files/2017/12/roadsSectionsNodes_good.png

Joining lineString segments before intersection extraction

[1] http://journals.sagepub.com/doi/pdf/10.1177/030913257900300104
[2] http://www.sciencedirect.com/science/article/pii/S0301479700903736
[3] https://www.degruyter.com/downloadpdf/j/emj.2016.8.issue-4/emj-2016-0033/emj-2016-0033.pdf

OpenEdition vous propose de citer ce billet de la manière suivante :
khartwell (15 décembre 2017). Creating Graphs. Métrologie des ambiances urbaines. Consulté le 9 octobre 2024 à l’adresse https://doi.org/10.58079/rar8


Vous aimerez aussi...

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.