I am trying to make a spatial join to calculate the mean value of many variables (100+ columns) of census tracts by city. In order to do that, I would, in QGIS Desktop, run a spatial join (join attributes by location). I did it and it worked. However, I need to automate the process and use the command line "processing" commands ("processing.runalg...").
Even tough it works in QGIS and should work in command line with the following line: processing.runalg("qgis:joinattributesbylocation", neighborsPath, censusPath, "['intersects']",1,"mean", 0, layerOutput)The process works, but gives an empty shapefile (1kb size).
As suggested in many posts (Why does "Join attributes by location" fail to compute sums when used in a model?) and (QGIS' Join Attributes by Location not working from Python script), I downgraded processing to v.2.2.0, and used the joinbylocation, the result only gives me stats for the first column of my joined shapefile and not for the 100+ columns I have. This is the line that I am using
rocessing.runalg("qgis:joinbylocation", neighborsPath, censusPath, 1, 'mean', 0,1, layerOutput)
I don't know if one of you encountered this problem and successfully fixed it.(p.s. I tried all versions of Processing)I hope someone can help me! (This is my first question on stackexchange, I hope it's well formulated enough)
Also, qgis:selectbylocation also gives empty shapefiles, for an unknown reason...
أكثر...
Even tough it works in QGIS and should work in command line with the following line: processing.runalg("qgis:joinattributesbylocation", neighborsPath, censusPath, "['intersects']",1,"mean", 0, layerOutput)The process works, but gives an empty shapefile (1kb size).
As suggested in many posts (Why does "Join attributes by location" fail to compute sums when used in a model?) and (QGIS' Join Attributes by Location not working from Python script), I downgraded processing to v.2.2.0, and used the joinbylocation, the result only gives me stats for the first column of my joined shapefile and not for the 100+ columns I have. This is the line that I am using
I don't know if one of you encountered this problem and successfully fixed it.(p.s. I tried all versions of Processing)I hope someone can help me! (This is my first question on stackexchange, I hope it's well formulated enough)
Also, qgis:selectbylocation also gives empty shapefiles, for an unknown reason...
أكثر...