Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QgsProcessingAlgorithm / add Layer to project #29492

Closed
qgib opened this issue Mar 26, 2019 · 2 comments
Closed

QgsProcessingAlgorithm / add Layer to project #29492

qgib opened this issue Mar 26, 2019 · 2 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@qgib
Copy link
Contributor

qgib commented Mar 26, 2019

Author Name: Valérian LEBERT (Valérian LEBERT)
Original Redmine Issue: 21676
Affected QGIS version: 3.4.5
Redmine category:processing/core


Hi,

I am trying to add a layer to project in a QgsProcessingAlgorithm.

I tried the folowing code :

vlayer1 = QgsVectorLayer('Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes', 'vlayer1', "memory")
vlayer2 = QgsVectorLayer('Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes', 'vlayer2', "memory")
vlayer3 = QgsVectorLayer('Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes', 'vlayer3', "memory")
vlayer4 = QgsVectorLayer('Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes', 'vlayer4', "memory")

context.addLayerToLoadOnCompletion(vlayer1.id(),context.LayerDetails('toto', QgsProject.instance(), self.OUTPUT))
context.addLayerToLoadOnCompletion(vlayer2.id(),context.LayerDetails('toto', context.project(), self.OUTPUT))
QgsProject.instance().addMapLayer(vlayer3, True)
context.project().addMapLayer(vlayer4, True)

None of the layer is loaded.
OUTPUT variable is a string :
OUTPUT = 'OUTPUT'

I get a warning on processing feedback with no details in message log :

Chargement des couches de résultat
Les couches suivantes n'ont pas été générées correctement.

  • vlayer1_98306459_f1bc_4285_b8dc_660502e5cb47
  • vlayer2_040a7ea0_7a5f_4e02_bfd1_4ce311c60219
Vous pouvez vérifier le Panel de messages du journal dans la fenêtre principale de QGIS pour trouver plus d'informations à propos de l'exécution de l'algorithme.

Am i doing wrong or is there something broken in procesing API?

Thanks
Valérian

@qgib
Copy link
Contributor Author

qgib commented Mar 26, 2019

Author Name: Giovanni Manghi (@gioman)


If this is not an issue report but rather a question this should be posted in the proper channels, the users/devolpers mailing lists, etc.


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented May 21, 2019

Author Name: Alexander Bruy (@alexbruy)


  • resolution was changed from to no timely feedback
  • status_id was changed from Feedback to Closed

@qgib qgib closed this as completed May 21, 2019
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant