Page 12 sur 18
Fix geometry
Fix invalid geometry (and register the output to use it later)
Here we register the output with the name MyFixedLayer
. So we can use it later.
alg_params = { 'INPUT':'C:\\Users\\georg\\Downloads\\MyLayer.shp', 'METHOD':1, 'OUTPUT':'C:\\Users\\georg\\Downloads\\MyFixedLayer.shp' } outputs['MyFixedLayer'] = processing.run('native:fixgeometries', alg_params, context=context)
Fix invalid geometry (from a previous output registered)
alg_params = { 'INPUT': outputs['MyPreviousOutput']['OUTPUT'], 'METHOD':1, 'OUTPUT': QgsProcessing.TEMPORARY_OUTPUT } outputs['MyNewOutput'] = processing.run('native:fixgeometries', alg_params, context=context)