<div dir="ltr">Hi Anita,<div><br></div><div>A QgsFeatureSink is an interface for accepting features. This can be a QgsVectorLayer but does not have to be one. It can also be a spatial index, a vector file writer or others.</div><div>I.e. your algorithm specifies that it produces "features" which can be sent to a vector layer, another algorithm or [you-name-it]. It doesn't care if it's a vector layer, which also has other properties like style.</div><div>This even leaves room for future optimization of processing pipelines, for example, features could be sent through various algorithms without waiting for the first one to be finished.</div><div><br></div><div>I hope that sheds some light</div><div>Matthias</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 23, 2022 at 1:48 PM Anita Graser via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><span></span>Thank you very much, Thomas. This code comparison approach is very useful indeed. <br><br>If FeatureSink covers all functions of VectorDestination and more, that still leaves me wonder what is the downside of a FeatureSink<div><br></div><div>"Note: Consider using the more flexible <a href="https://api.qgis.org/api/3.22/classQgsProcessingParameterFeatureSink.html" title="A feature sink output for processing algorithms." target="_blank">QgsProcessingParameterFeatureSink</a> wherever possible."</div><div><br></div><div>i.e. where is it not possible to use a Feature Sink? Only in older versions of QGIS? </div><div><br></div><div>Regards,</div><div>Anita</div><div><br><br>On Saturday, 22. October 2022 23:32:11 (+02:00), Thomas Gratier wrote:<br><br><blockquote style="margin:0px 0px 0.8ex;border-left:2px solid rgb(0,0,255);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>Although, I do know the intend to recommend one against the other, doing some code differences helps to sort out things.</div><div>They both inherits from same classes but the constructor for QgsProcessingParameterFeatureSink accepts an additionnal arg bool <a href="https://api.qgis.org/api/3.22/classQgsProcessingParameterFeatureSink.html#acae2863d5dab37aec4c5466d7d3a84d9" target="_blank">supportsAppend</a>=false</div><div><br></div><div>You also find the additional methods in QgsProcessingParameterFeatureSink to manipulate the same supportsAppend.</div><div><br></div><div>```</div><div>a = QgsProcessingParameterVectorDestination(<br>  'OUTPUT',<br>  'Sortie'<br>)<br><br>b = QgsProcessingParameterFeatureSink(<br>  'OUTPUT',<br>  'Sortie'<br>)<br><br>methods_a = dir(a)<br>methods_b = dir(b)<br>common_methods = set(methods_a).intersection(methods_b)<br>print(common_methods)<br><br>only_in_a = set(methods_a).difference(methods_b)<br></div><div>print(only_in_a)</div><div><br>only_in_b = set(methods_b).difference(methods_a)</div><div>print(only_in_b)</div><div>```</div><div><br></div><div>Regards</div><div><br></div><div>Thomas Gratier</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 21 oct. 2022 à 18:07, Anita Graser via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="padding-left:1ex;border-left:1px solid rgb(204,204,204);margin:0px 0px 0px 0.8ex"><div><div>Thank you Stefan,</div><div><br></div><div>I saw that note but was hoping some developer could shed light on what they mean by "more flexible" and "wherever possible". I guess otherwise it's just trial and error. </div><div><br></div><div>Regards,</div><div>Anita</div><span></span><br><br>On Wednesday, 19. October 2022 07:44:05 (+02:00), Stefan Giese (WhereGroup) wrote:<br><br><blockquote style="padding-left:1ex;border-left:2px solid rgb(0,0,255);margin:0px 0px 0.8ex">
    
  
  
    <p>Hi Anita,</p>
    <p>they are very similar, but the API Documentation says to <span dir="ltr" style="margin-top:0px;margin-bottom:0px">QgsProcessingParameterVectorDestination:</span>
      "Note: Consider using the more flexible <a href="https://api.qgis.org/api/3.22/classQgsProcessingParameterFeatureSink.html" title="A feature sink output for processing algorithms." target="_blank">QgsProcessingParameterFeatureSink</a>
      wherever possible."
(<a href="https://api.qgis.org/api/3.22/classQgsProcessingParameterVectorDestination.html#details" target="_blank">https://api.qgis.org/api/3.22/classQgsProcessingParameterVectorDestination.html#details</a>)</p>
    <p>Best regards</p>
    <p>Stefan<br>
    </p>
    <div>Am 18.10.2022 um 20:35 schrieb Anita
      Graser via QGIS-Developer:<br>
    </div>
    <blockquote type="cite">
      
      
      <span dir="ltr" style="margin-top:0px;margin-bottom:0px">Hi. </span>
      <br>
      <br>
      <span dir="ltr" style="margin-top:0px;margin-bottom:0px">Does any
        one of you know the real difference between
        QgsProcessingParameterVectorDestination versus
        QgsProcessingParameterFeatureSink? They seem to be used
        interchangably in the resources I can find.</span> <br>
      <br>
      <span dir="ltr" style="margin-top:0px;margin-bottom:0px">Thank you.</span>
      <br>
      <br>
      <span dir="ltr" style="margin-top:0px;margin-bottom:0px">Anita</span>
      <br>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
QGIS-Developer mailing list
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
---------------------------------------------
Aufwind durch Wissen!
Jetzt neu: Web-Seminare und Online-Schulungen
bei der <a href="http://www.foss-academy.com" target="_blank">www.foss-academy.com</a>
---------------------------------------------
WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany

Tel.: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

<a href="mailto:stefan.giese@wheregroup.com" target="_blank">stefan.giese@wheregroup.com</a>
<a href="http://www.wheregroup.com" target="_blank">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885</pre>
  

</blockquote><span></span></div></blockquote><span><br>-- <br>--<br>Anita Graser<br>Home: <a href="http://anitagraser.com" target="_blank">http://anitagraser.com</a><br>Twitter: @underdarkgis</span></div></blockquote></div></div>_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>

<br>
<div style="text-align:left"><a href="https://qfield.org/get/" target="_blank"><img src="https://www.opengis.ch/wp-content/uploads/2022/04/Qfield_Banner_email.png" alt="https://qfield.org/get/"></a><span style="font-family:Arial"><a><br></a></span></div><div style="text-align:left"><span style="font-family:Arial">QFIELD 2.0 IS HERE!<span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><font size="3"> </font></span>- Hold the power of QGIS in your hand</span><span style="font-family:Arial"> - <a href="https://www.opengis.ch/2022/04/05/qfield-2-0-is-here/" target="_blank">learn more</a> - <a href="https://qfield.org/get" target="_blank">get it now</a><br></span></div>