1

I have two files (shapefiles). A file with 50x50 meter cells. and a grid with 100 by 100 meter cells. I want to do 'union' so that I know which 4 cells of the 50x50 meter vector layer make up one cell of the 100 by 100 meter layer. However, when I do this, there is for some reason a mistake when doing this. I am expecting 4 different ID values for the 50x50 meter file to 1 ID value for the 100x100 meter grid. However, there is many more. This makes me conclude the layers are not aligned. However,

I use the same projection for both vector layers, so I think that should not be the problem. When I zoom in as far as I can and I change the transparency of the top layer, I still do not see even the slightest mistake in terms of alignment. I have also tried intersect.

  • It doesn't sound like you need to combine the geometries, just the attributes. Try this: Vector Menu > Data Management Tools > Join attributes by location. – csk Apr 19 '18 at 17:14
  • Thanks for this! I tried this too. However, when I join them by location, there is heaps to choose from: intersect, contain, overlap etc. I tried them all, and also tried them all changing the target and join fields around, but I never got a result that worked. There usually is around 9 50x50 values per 100x100 value. and they overlap. So say: ID_100=0 has ID_50=0,1,2,174,175,175,348,349,350 then ID_100=1 has ID_50= 1,2,3,4,175,176,177,178,349,359,351,352 – Demi Vonk Apr 19 '18 at 17:19
  • Try using the Centroids tool on the 50x50 layer, then join attributes of the centroids to the 100x100 layer. Then join the attributes of the centroids back to the 50x50 layer. – csk Apr 19 '18 at 18:29
  • I used the centroids tool, but then when I join the attributes again; do I use 'join by location?' and if yes; intersects, equals, overlaps? – Demi Vonk Apr 19 '18 at 18:53
1

Use Centroids tool to create temporary layer of centroids of 50x50 vector layer.

enter image description here

Use Join attributes by location to join 100x100 vector layer attributes to centroids layer. Leave the default setting of [Create a temporary layer]. enter image description here

Join attributes from the Joined layer to 50x50 vector layer. Instead of creating a temporary layer, add a file path so the new layer is saved as a permanent file. enter image description here

0

Together with QGIS Grass GIS is installed and most tools are available through the processing toolbox in QGIS. There you have the tool v.overlay (use the "or" operator for union) that allows for union and other operations.

As an advanced parameter you have a snapping distance where you can set a tolerance for the boundaries. This should help with not exactly matching geometries. Also the GRASS GIS tools are more robust in case of geometry accuracy because of its topology data model.

Sometimes the boundaries are different at the 7th or 8th digit which can happen when you have different tools or software. This is nearly as common as exactly matching geometries.

  • Hi Matte, Thanks for your help, but when I run this and at some point it seems like it's done running, nothing appears in my layer panel. Any idea on what goes wrong? – Demi Vonk Apr 19 '18 at 17:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.