24.1.18. Vector selection
24.1.18.1. Extract by attribute
Creates two vector layers from an input layer: one will contain only matching features while the second will contain all the non-matching features.
The criteria for adding features to the resulting layer is based on the values of an attribute from the input layer.
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Layer to extract features from. |
Selection attribute |
|
[tablefield: any] |
Filtering field of the layer |
Operator |
|
[enumeration] Default: 0 |
Many different operators are available:
|
Value Optional |
|
[string] |
Value to be evaluated |
Extracted (attribute) |
|
[same as input] Default: |
Specify the output vector layer for matching features. One of:
The file encoding can also be changed here. |
Extracted (non-matching) |
|
[same as input] Default: |
Specify the output vector layer for non-matching features. One of:
|
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Extracted (attribute) |
|
[same as input] |
Vector layer with matching features from the input layer |
Extracted (non-matching) |
|
[same as input] |
Vector layer with non-matching features from the input layer |
Python code
Algorithm ID: qgis:extractbyattribute
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.2. Extract by expression
Creates two vector layers from an input layer: one will contain only matching features while the second will contain all the non-matching features.
The criteria for adding features to the resulting layer is based on a QGIS expression. For more information about expressions see the 式.
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Input vector layer |
Expression |
|
[expression] |
Expression to filter the vector layer |
Matching features |
|
[same as input] Default: |
Specify the output vector layer for matching features. One of:
The file encoding can also be changed here. |
Non-matching |
|
[same as input] Default: |
Specify the output vector layer for non-matching features. One of:
|
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Matching features |
|
[same as input] |
Vector layer with matching features from the input layer |
Non-matching |
|
[same as input] |
Vector layer with non-matching features from the input layer |
Python code
Algorithm ID: qgis:extractbyexpression
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.3. Extract by location
Creates a new vector layer that only contains matching features from an input layer.
The criteria for adding features to the resulting layer is based on the spatial relationship between each feature and the features in an additional layer.
![../../../../_images/selectbylocation.png](../../../../_images/selectbylocation.png)
図 24.100 In this example, the dataset from which we want to select (the source vector layer) consists of the green circles, the orange rectangle is the dataset that it is being compared to (the intersection vector layer).
Available geometric predicates are:
- Intersect
Tests whether a geometry intersects another. Returns 1 (true) if the geometries spatially intersect (share any portion of space - overlap or touch) and 0 if they don’t. In the picture above, this will select circles 1, 2 and 3.
- Contain
Returns 1 (true) if and only if no points of b lie in the exterior of a, and at least one point of the interior of b lies in the interior of a. In the picture, no circle is selected, but the rectangle would be if you would select it the other way around, as it contains a circle completely. This is the opposite of are within.
- Disjoint
Returns 1 (true) if the geometries do not share any portion of space (no overlap, not touching). Only circle 4 is selected.
- Equal
Returns 1 (true) if and only if geometries are exactly the same. No circles will be selected.
- Touch
Tests whether a geometry touches another. Returns 1 (true) if the geometries have at least one point in common, but their interiors do not intersect. Only circle 3 is selected.
- Overlap
Tests whether a geometry overlaps another. Returns 1 (true) if the geometries share space, are of the same dimension, but are not completely contained by each other. Only circle 2 is selected.
- Are within
Tests whether a geometry is within another. Returns 1 (true) if geometry a is completely inside geometry b. Only circle 1 is selected.
- Cross
Returns 1 (true) if the supplied geometries have some, but not all, interior points in common and the actual crossing is of a lower dimension than the highest supplied geometry. For example, a line crossing a polygon will cross as a line (selected). Two lines crossing will cross as a point (selected). Two polygons cross as a polygon (not selected).
参考
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Extract features from |
|
[vector: any] |
Input vector layer |
Where the features (geometric predicate) |
|
[enumeration] [list] Default: [0] |
Spatial condition for the selection. One or more of:
If more than one condition is chosen, at least one of them (OR operation) has to be met for a feature to be extracted. |
By comparing to the features from |
|
[vector: any] |
Intersection vector layer |
Extracted (location) |
|
[same as input] Default: |
Specify the output vector layer for the features that have the chosen spatial relationship(s) with one or more features in the comparison layer. One of:
|
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Extracted (location) |
|
[same as input] |
Vector layer with features from the input layer that have the chosen spatial relationship(s) with one or more features in the comparison layer. |
Python code
Algorithm ID: qgis:extractbylocation
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.4. Random extract
Takes a vector layer and generates a new one that contains only a subset of the features in the input layer.
The subset is defined randomly, based on feature IDs, using a percentage or count value to define the total number of features in the subset.
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Source vector layer to select the features from |
Method |
|
[enumeration] Default: 0 |
Random selection methods. One of:
|
Number/percentage of selected features |
|
[number] Default: 10 |
Number or percentage of features to select |
Extracted (random) |
|
[vector: any] Default: |
Specify the output vector layer for the randomly selected features. One of:
Vector layer containing randomly selected features |
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Extracted (random) |
|
[same as input] |
Vector layer containing randomly selected features from the input layer |
Python code
Algorithm ID: qgis:randomextract
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.5. Random extract within subsets
Takes a vector layer and generates a new one that contains only a subset of the features in the input layer.
The subset is defined randomly, based on feature IDs, using a percentage or count value to define the total number of features in the subset. The percentage/count value is not applied to the whole layer, but instead to each category. Categories are defined according to a given attribute.
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Vector layer to select the features from |
ID field |
|
[tablefield: any] |
Category of the source vector layer to select the features from |
Method |
|
[enumeration] Default: 0 |
Random selection method. One of:
|
Number/percentage of selected features |
|
[number] Default: 10 |
Number or percentage of features to select |
Extracted (random stratified) |
|
[same as input] Default: |
Specify the output vector layer for the randomly selected features. One of:
The file encoding can also be changed here. |
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Extracted (random stratified) |
|
[same as input] |
Vector layer containing randomly selected features from the input layer |
Python code
Algorithm ID: qgis:randomextractwithinsubsets
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.6. Random selection
Takes a vector layer and selects a subset of its features. No new layer is generated by this algorithm.
The subset is defined randomly, based on feature IDs, using a percentage or count value to define the total number of features in the subset.
Default menu:
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Vector layer for the selection |
Method |
|
[enumeration] Default: 0 |
Random selection method. One of:
|
Number/percentage of selected features |
|
[number] Default: 10 |
Number or percentage of features to select |
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[same as input] |
The input layer with features selected |
Python code
Algorithm ID: qgis:randomselection
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.7. Random selection within subsets
Takes a vector layer and selects a subset of its features. No new layer is generated by this algorithm.
The subset is defined randomly, based on feature IDs, using a percentage or count value to define the total number of features in the subset.
The percentage/count value is not applied to the whole layer, but instead to each category.
Categories are defined according to a given attribute, which is also specified as an input parameter for the algorithm.
No new outputs are created.
Default menu:
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Vector layer to select features in |
ID field |
|
[tablefield: any] |
Category of the input layer to select the features from |
Method |
|
[enumeration] Default: 0 |
Random selection method. One of:
|
Number/percentage of selected features |
|
[number] Default: 10 |
Number or percentage of features to select |
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[same as input] |
The input layer with features selected |
Python code
Algorithm ID: qgis:randomselectionwithinsubsets
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.8. Select by attribute
Creates a selection in a vector layer.
The criteria for selecting features is based on the values of an attribute from the input layer.
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Vector layer to select features in |
Selection attribute |
|
[tablefield: any] |
Filtering field of the layer |
Operator |
|
[enumeration] Default: 0 |
Many different operators are available:
|
Value Optional |
|
[string] |
Value to be evaluated |
Modify current selection by |
|
[enumeration] Default: 0 |
How the selection of the algorithm should be managed. One of:
|
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[same as input] |
The input layer with features selected |
Python code
Algorithm ID: qgis:selectbyattribute
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.9. Select by expression
Creates a selection in a vector layer.
The criteria for selecting features is based on a QGIS expression. For more information about expressions see the 式.
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[vector: any] |
Input vector layer |
Expression |
|
[expression] |
Expression to filter the input layer |
Modify current selection by |
|
[enumeration] Default: 0 |
How the selection of the algorithm should be managed. One of:
|
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[same as input] |
The input layer with features selected |
Python code
Algorithm ID: qgis:selectbyexpression
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.
24.1.18.10. 場所による選択
Creates a selection in a vector layer.
The criteria for selecting features is based on the spatial relationship between each feature and the features in an additional layer.
![../../../../_images/selectbylocation.png](../../../../_images/selectbylocation.png)
図 24.101 In this example, the dataset from which we want to select (the source vector layer) consists of the green circles, the orange rectangle is the dataset that it is being compared to (the intersection vector layer).
Available geometric predicates are:
- Intersect
Tests whether a geometry intersects another. Returns 1 (true) if the geometries spatially intersect (share any portion of space - overlap or touch) and 0 if they don’t. In the picture above, this will select circles 1, 2 and 3.
- Contain
Returns 1 (true) if and only if no points of b lie in the exterior of a, and at least one point of the interior of b lies in the interior of a. In the picture, no circle is selected, but the rectangle would be if you would select it the other way around, as it contains a circle completely. This is the opposite of are within.
- Disjoint
Returns 1 (true) if the geometries do not share any portion of space (no overlap, not touching). Only circle 4 is selected.
- Equal
Returns 1 (true) if and only if geometries are exactly the same. No circles will be selected.
- Touch
Tests whether a geometry touches another. Returns 1 (true) if the geometries have at least one point in common, but their interiors do not intersect. Only circle 3 is selected.
- Overlap
Tests whether a geometry overlaps another. Returns 1 (true) if the geometries share space, are of the same dimension, but are not completely contained by each other. Only circle 2 is selected.
- Are within
Tests whether a geometry is within another. Returns 1 (true) if geometry a is completely inside geometry b. Only circle 1 is selected.
- Cross
Returns 1 (true) if the supplied geometries have some, but not all, interior points in common and the actual crossing is of a lower dimension than the highest supplied geometry. For example, a line crossing a polygon will cross as a line (selected). Two lines crossing will cross as a point (selected). Two polygons cross as a polygon (not selected).
Default menu:
パラメーター
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Select features from |
|
[vector: any] |
Input vector layer |
Where the features (geometric predicate) |
|
[enumeration] [list] Default: [0] |
Spatial condition for the selection. One or more of:
If more than one condition is chosen, at least one of them (OR operation) has to be met for a feature to be extracted. |
By comparing to the features from |
|
[vector: any] |
Intersection vector layer |
Modify current selection by |
|
[enumeration] Default: 0 |
How the selection of the algorithm should be managed. One of:
|
出力
ラベル |
名前 |
タイプ |
説明 |
---|---|---|---|
Input layer |
|
[same as input] |
The input layer with features selected |
Python code
Algorithm ID: qgis:selectbylocation
import processing
processing.run("algorithm_id", {parameter_dictionary})
The algorithm id is displayed when you hover over the algorithm in the Processing Toolbox. The parameter dictionary provides the parameter NAMEs and values. See プロセシングアルゴリズムをコンソールから使う for details on how to run processing algorithms from the Python console.