This adds a lot of flexibility to algorithms, as it makes output
sinks truely optional. For instance, the various "Extract by..."
algorithms could add a new optional sink for features which
'fail' the extraction criteria. This effectively allows these
algorithms to become feature 'routers', directing features onto
other parts of a model depending on whether they pass or fail
the test.
But in this situation we don't always care about these failing
features, and we don't want to force them to always be fetched
from the provider. By making the outputs truely optional,
the algorithm can tweak its logic to either fetch all features
and send them to the correct output, or only fetch
matching features from the provider in the first place (a big
speed boost).
Flip all scale based widgets to use scale denominators instead
of actual scales (ie 100.0 instead of 0.01 for 1:100).
This is done for consistency with the rest of the API, which
predominantly uses scale denominators. It also helps
precision loss as a result of multiple 1.0 / scale conversions
throughout the code.
Refs #15337
If set, all geometries will be reprojected from their original
coordinate reference system to the destination CRS while
iterating over features.
If a CRS has been set as the destination CRS, then the filterRect
parameter should be specified in the same CRS as this destination
CRS.
Additionally, a callback function can be specified on the request
to be called if a transform exception is encountered while
iterating over features.
This is designed to make it easier for scripts and plugins to
correctly reproject layers in an efficient and robust way, instead
of having to implement lots of repeated code themselves and
potentially missing some of the important considerations which
come with reprojecting geometries & bounding boxes.
Now, if a script wants the features from a layer in a specific
CRS, they can call:
crs = QgsCoordinateReferenceSystem('epsg:4326')
request = QgsFeatureRequest().setDestinationCrs(crs)
for f in layer.getFeatures(reqeuest):
print('geometry in 4326 is {}.format(f.geometry().exportToWkt()))