Extracting Intersections

T4QG offers two diferent methods for extracting the open space at intersections.

Intersections are here defined by points (i.e., a QgsPoint Layer). You may already have a a point layer available, or you may have to extract it from lineString data using STToRoadsSectionsNodes().

An isovist is a tool used for the simulation and analysis of visibility from an individual point of view. More information can be found in the post about Understanding Ray Casting and Isovists.
The following method requires the input of a layer of buildings (polygons) and a layer of points, and outputs a layer of isovists and a layer of cast rays.

STIsovistField2D(buildingsLayer, viewPointsLayer, nRays, rayLength)
Parameters:
  • buildingsLayer (QgsVectorLayer) – the vector layer containing polygons constituting the visual obstacles
  • viewPointsLayer (QgsVectorLayer) – the vector layer containing the generation points for the ray casting process
  • nRays (int) – The number of rays cast per point to create the isovists
  • rayLength (float) – the length of the rays used to determine the viewshed limit (in meters)
Returns:

A vector layer containg the ray field

Returns:

A vector layer containg the isovist field

http://mau.hypotheses.org/files/2017/12/node_for_intersection.png

A point in the open space

http://mau.hypotheses.org/files/2017/12/node_for_rayCast.png

The first step consists of casting rays according to the number and length set by the user. Here, nRays = 128, rayLength = 50

http://mau.hypotheses.org/files/2017/12/node_for_isovist.png

The second step joins the ray extremities to create a plygonal outline of the isovist. Notice how the precision of the isovist directly depends on the number of rays.

A second option is available which does not rely on the point’s visibility, rather using a buffer to extract the surrounding open space.

STExtractIntersections(nodes, buildings, nodesIdFFieldName, buffDist, nsegm).execute()
Parameters:
  • nodes (qgsVectorLayer) – The input vector layer of points
  • buildings (qgsVectorLayer) – The input vector layer of polygons
  • nodesIfFieldName (string) – The name of the point layer’s attribute column indicating the unique identifier.
  • nsegm (int) – The number of sides of the buffer. -1 returns a square buffer.
Returns:

A qgsVectorLayer containing the area of the buffer zones at each point minus the areas of the buildings layer.

http://mau.hypotheses.org/files/2017/12/node_for_intersectionExtraction.png

The result is the diffference between the buildings layer and the buffer (here, 50m.)

As you can see, the isovist acts with only partial knowledge of its surroundings, whilst the buffer allows for the extraction of the intersection with full knowledge of the terrain. Both come in handy under different circumstances.