I want to add some fields in a temporary layer in order to use it in another process.
What I tried to do is below :
shp_result = processing.run(
'native:pixelstopoints',
{
'INPUT_RASTER': raster_redim['OUTPUT'],
'RASTER_BAND': 1,
'FIELD_NAME': 'VALUE',
'OUTPUT': 'TEMPORARY_OUTPUT'
},
is_child_algorithm=True,
context=context,
feedback=feedback)
# On ajoute 2 autres champs pour contenir les coordonnées X, Y
# du point de cours d'eau associé au point d'intérêt
self.maCouche = QgsVectorLayer(shp_result['OUTPUT'], self.nom[0], 'ogr')
prov = self.maCouche.dataProvider()
prov.addAttributes([QgsField("X", QVariant.Double)])
prov.addAttributes([QgsField("Y", QVariant.Double)])
self.maCouche.updateFields()
dist_fNul = processing.run(
'grass7:v.distance',
{
'from': self.maCouche.source(),
'from_type':[0,1,3],
'to': parameters[self.MASK],
'to_type':[0,1,3],
'dmax':-1,
'dmin':-1,
'upload':[1,2,3],
'column':['VALUE', 'X', 'Y'],
'to_column':None,
'from_output': parameters[self.OUTPUT],
'output':'TEMPORARY_OUTPUT',
'GRASS_REGION_PARAMETER':None,
'GRASS_SNAP_TOLERANCE_PARAMETER':-1,
'GRASS_MIN_AREA_PARAMETER':0.0001,
'GRASS_OUTPUT_TYPE_PARAMETER':0,
'GRASS_VECTOR_DSCO':'',
'GRASS_VECTOR_LCO':'',
'GRASS_VECTOR_EXPORT_NOCAT':False
},
is_child_algorithm=True,
context=context,
feedback=feedback
)
But the final result is not what I expect : only the 'VALUE' field is created instead of giving me tree fields 'VALUE', 'X', 'Y' (in dist_fNul).
grass7:v.distance
?