Indeed, if you can, you should use a QgsProcessingFeatureBasedAlgorithm algorithm. It will make some shortcuts for you and the code is shorter because you will only have a single feature to process.
Have a look to existing source code : https://github.com/qgis/QGIS/search?q=QgsProcessingFeatureBasedAlgorithm Le mar. 24 août 2021 à 04:55, Ujaval Gandhi <uja...@spatialthoughts.com> a écrit : > If your algorithm works on each feature independently, processFeature() is > preferred. If you need to work with layers, you need to use > processAlgorithm(). I demonstrate this with an example at > https://spatialthoughts.com/2019/04/05/geodesic-buffers-in-qgis/ > > On Mon, 23 Aug 2021 at 10:25 PM, C Hamilton <adenacult...@gmail.com> > wrote: > >> I discovered that it looks like there is another way to deal with >> processing algorithms. Rather than use processAlgorithm it looks like I can >> use prepareAlgorithm & processFeature. I have always used processAlgorithm >> and then iterated through the features. >> >> Is processFeature just as quick as using processAlgorithm (iterating >> through the features)? Is one method preferred over the other? I think for >> some algorithms using processFeature would make the code look cleaner. Are >> there any gotchas in using the processFeature method? >> >> Thanks, >> >> Calvin >> _______________________________________________ >> Qgis-user mailing list >> Qgis-user@lists.osgeo.org >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user >> > -- > [image: Logo] <https://spatialthoughts.com/> > Ujaval Gandhi > Spatial Thoughts > mobile: +91-8095684687 > email: uja...@spatialthoughts.com > [image: LinkedIn icon] <https://www.linkedin.com/in/spatialthoughts/> [image: > Twitter icon] <https://twitter.com/spatialthoughts> > > _______________________________________________ > QGIS-Developer mailing list > qgis-develo...@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer >
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user