> 3) I see no reason to return a layer to QGIS if it has no data which is
the reason to check the feature count. In the processAlgorithm return
statement do I only return those layers that have data?
>
> return {
> self.PrmPointOutputLayer: dest_id_pt,
> self.PrmLineOutputLayer: dest_id_line,
> self.PrmPolygonOutputLayer: dest_id_poly
> }
> You can omit these from the returned dictionary in this case - so if
> you're recording the counts of features added to each sink, only add
> entries to the results dictionary where the count is > 0.
This almost did what was needed. It looks like calling
(sinkPt, dest_id_pt) = self.parameterAsSink(parameters,
self.PrmPointOutputLayer, context, fields,
QgsWkbTypes.Point, epsg4326)
is what determines what layers are added to QGIS and not the dictionary I
return. I guess I'm going to need to call parameterAsSink the first time I
have data to be added. This is going to make the code more messy, but I
don't know another way to prevent empty layers from being added.
Calvin
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer