Welcome to Multi-Distance Buffer’s documentation!¶
Contents:
Functionality¶
The Multi-Distance Buffer plugin creates a multi-distance / multi-zone / multi-ring vector dataset from an input vector layer and a set of distances.
The resulting dataset consists of one (multi)polygon (“donut type”) for each buffer distance. The (multi)polygons do not overlap. The attribute table of the result dataset will have one column / field named distance, that contains the (maximum) distance for the (multi)polygon. The memory layer containing the dataset is added to the QGIS table of contents.
If 100 and 200 are provided as distances, the result dataset will consist of two zones / bands / (multi)polygons - one will contain all areas that are within 100 units from the geometries of the input vector layer (including the geometries themselves), the other will contain all areas that are from 100 to 200 units from the geometries of the input vector layer.
The buffer distances (decimal numbers) can be specified by the user in any order. The list will be kept numerically sorted by the Plugin.
Negative and 0.0 buffer distances are allowed for polygon layers.
Buffer distances can be added and deleted in the dialogue using the Add and Remove buttons. The keyboard can be used to add the buffer distances quickly (number followed by <enter>).
A checkbox (Use only selected features) can be used to choose to only buffer around selected features. If the user selects a layer with a selection, the default will be set to only use selected features. If there is no selection in the chosen layer, the default will be set to not only use selected features. The user can modify this behaviour with the checkbox.
Three approaches to buffering are offered by the plugin.
Standard. Will use five segments to represent a quarter circle for the buffer geometries in the result dataset.
Note: The “standard” option is currently not available for QGIS 3 due to threading issues with QgsGeometryAnalyzer buffer
Segments to approximate. The user specifies the number of segments to use for a quarter circle.
Maximum deviation. The user specifies the maximum radial deviation from the specified buffer distances. The number of segments per quarter circle will be calculated based on the buffer distance, and will increase with increasing buffer distances.
Implementation¶
With the standard approach, buffers for all the distances are created using the buffer function of QgsGeometryAnalyzer. The buffer function of QgsGeometryAnalyzer does not support the specification of buffer accuracy (segments / arc vertex distance / maximum deviation), so the default of 5 segments has to be used.
The buffer function of QgsGeometryAnalyzer does not support memory layers as output, so a temporary (using the Python tempfile module) Shapefile format dataset is created for each buffer distance. The temporary datasets are later deleted.
For the other two approaches, the buffer function of QgsGeometry is used, and the resulting buffer geometries are combined using the dissolve function of QgsGeometry.
The buffers are combined to form the result multi-distance buffer dataset using the symDifference function of QgsGeometry for all the approaches.