I am getting this weird error while using join attributes by location in QGIS, I have two layers - Source & Target. I am joining by target to source features using intersect option in join attributes by location.
Here is my script:
QgisAll_layers = QgsProject.instance().mapLayers().values()
path = QgsProject.instance().absolutePath()
joined = str(path) + "//source_target_joined.shp"
unjoined = str(path) + "//source_target_unjoined.shp"
processing.run("qgis:joinattributesbylocation", {
'INPUT': Source,
'JOIN': Target,
'PREDICATE': [0], 'JOIN_FIELDS': [], 'METHOD': 0, 'DISCARD_NONMATCHING': False, 'PREFIX': 'jj',
'OUTPUT': joined, 'NON_MATCHING': unjoined})
Joined attribute table not having target field values.
I understand that the spatial join of features is not happening due to some reasons, it is not able to spatially identify the features in my script.
The Join Count is coming zero, even when I have tried to reproject both the vector layers to project CRS. I have tried to add spatial index to both the points but still it did not work.
processing.run
in the script above? Did you tryprocessing.runAndLoadResults
instead ofprocessing.run
?