8

I have used QGIS process 'join attributes by location' in one of the models I have built and I have now been asked to explain in detail exactly how the model is determining the results.

I am using it to fill in spaces in the data by joining by location using the touching option with 0.1 precision and taking attributes of the first located feature.

I have tried making mock squares and applying the same principles to determine what way QGIS picks the first located feature but I have been unsuccessful in determining how exactly it is doing it.

I have considered N-S, E-W and also the order of which the Data being transferring has been created but none of them seems to explain how it chooses the feature.

I have looked for answers to this online and in the QGIS website but have found no explanation enter image description here

Above is a sample of what results when trying this technique. The light blue are the original polygons with their creation order attached in the attribute table and the purple is the number that joins when testing join by location to assign a number to the blank purple polygons from the light blue ones.

Does anyone know exactly how QGIS selects this number to assign?

QGIS Version 2.18.28

  • 1
    I don't know, but my guess would be either the row number or feature id. You do a similar comparison by adding these to fields in the Field Calculator with the @row_number variable and the $id variable. – csk Apr 5 at 16:08
  • 1
    The numbers in the Light blue squares are the ID no's. This is also the order in which the squares where created in the layer. I thought it could possibly have been this way you expected also as 1 and 2 behaved in this way, but when looking at the last 2 purple poly's then by that reasoning no's 4 and 6 should have filled the purples poly's, but this doesnt appear to have happened. – David Laverty Apr 8 at 11:21
  • It may also be due to spatial indexes. – J. Monticolo May 2 at 8:10
  • 1
    For Spatialite : gaia-gis.it/gaia-sins/spatialite-cookbook/html/rtree.html . If your layer have spatial indexes, spatial operations uses them and, I think, this affects the order of the result. Database layers or even shapefiles can have spatial indexes. – J. Monticolo May 2 at 8:52
  • 3
    Each Polygons node location has been considered as a factor from each of the four corners already, along with the ID number (which is also the order in which the polygons were created). It still doesn't appear to follow any specific pattern we have come up with, which it must as someone has programmed the process so it must follow some type of rules. It surely cant just be a random grab of one touching feature can it, as I believe computers are incapable of being truly random by design – David Laverty May 2 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.