Layer builder
Help to build layers that fits Niva's index computation requirements using a CSV file and a root folder to match layers. The CSV contain informations on which features to extract from which layer and what buffer to apply on these features.
algorithm id: niva:layerbuilder
Parameters
| Name |
Optionnal |
Type |
Description |
| ROI |
False |
QgsVectorLayer |
Region of interest. |
| CSV |
False |
STRING / File Path |
Path to CSV that contain features extraction informations. CSV structure is explained below. |
| FOLDER |
False |
STRING / Folder Path |
Path to root folder. Layers will be match recursively from this folder. |
Outputs
| Name |
Type |
Description |
| OUTPUT |
QgsVectorLayer |
Output layer with extracted features. |
OUTPUT layer contain the following fields:
| Name |
Type |
Description |
| type |
STRING |
Feature type from CSV file. |
CSV structure
CSV file should use ';' as columns separator to not interfer with QgsExpression parsing that could contain ',' . All csv columns are displayed in the following table:
Columns
| Name |
Description |
Optionnal |
| pattern |
Regular expression to match layers in folder (i.e *building*.shp will match every file that contain 'building' and that end with the .shp extension). |
|
| filter |
Expression to filter features from layer. Thise expression should respect QgsExpression format (same as used in Expression panel). i.e. NATURE = 'road', this expression wil extract all features where NATURE field is road. |
True, let empty to gather all features. |
| formula |
Expression to compute distance for buffer. Thise expression should respect QgsExpression format (same as used in Expression panel). i.e WIDTH * 1.5 will apply on each feature a buffer with distance: feature's width (based on it's field WIDTH) * 1.5. Buffer expression can be fix: 1.5 |
True, let empty for no buffer. |
| type |
The feature type (i.e building). This will fill the type field on output layer. |
False |
| default_values |
Contain default values for fields used in buffer formula in cas of the feature's value for this field is NULL. The algortihm will first try to fill the feature's field with median of this field on layer (after filtering) and if no value found fill with defautl value. i.e. with formula WIDTH * 1.5 and default values WIDTH=5. If multiple fields are used in formula juste write Field1=Value1,Field2=Value2 without space. |
False but should be filled only if field are used in formula, else let it empty. |
Example
| pattern |
filter |
formula |
type |
default_values |
effect |
| *CEMETERY*.shp |
|
|
cemetery |
|
Gather all features of CEMETERY layers with no buffer. |
| *PYLONE*.shp |
|
0.5 |
pylon |
|
Gather all features of PYLON layer and apply a fix buffer of 0.5m. |
| *CONSTRUCTION*.shp |
"NATURE = 'Windmill'" |
2.5 |
windmill |
|
Gather all features of CONSTRUCTION layer that have 'Windmill' for field NATURE and apply a buffer of 2.5m. |
| *CONSTRUCTION*.shp |
"NATURE != 'Windmill'" |
0.5 |
isolated_construction |
|
Gather all features of CONSTRUCTION layer that don't have 'Windmill' for field NATURE and apply a buffer of 0.5m. |
| *TRANSPORTS*.shp |
"NATURE IN ('Sorting Area', 'Parking')" |
|
transports_area |
|
Gather all features of TRANSPORTS layer that have either 'Sorting Area' or 'Parking' for field NATURE. |
| *ROAD*.shp |
"NATURE = 'path'" |
WIDTH |
path |
WIDTH=0.5 |
Gather all features of ROAD layer that have 'path' for field NATURE and apply a buffer of WIDTH. if feature's WIDTH is NULL, fill with median or 0.5m if no values. |
| *ROAD*.shp |
"NATURE = 'Highway'" |
WIDTH |
Highway |
WIDTH=9.5 |
Gather all features of ROAD layer that have 'Highway' for field NATURE and apply a buffer of WIDTH. if feature's WIDTH is NULL, fill with median or 9.5m if no values. |
| *TRAIN*.shp |
|
NB_LINES * 1.25 |
train_line |
NB_VOIES=2 |
Gather all features of TRAIN and apply a buffer of 1.25 NB_LINES. if feature's NB_LINES is NULL, fill with median or 2 if no values. |