I have successfully done spatial joins with QGIS many times. However, with two shapefiles QGIS hangs or never seems to complete. (I’ve let the process run for over two hours.)
I’ve tried all the obvious things that I can find by searching and reading other posts, e.g., making sure the two shapefiles have the same CRS (link), but it always hangs. What’s more confusing is that I can spatially join both shapefiles with the same other shapefile, but I can’t join them directly. IOW, spatial-join(A,B) and spatial-join(B-C) both work, but spatial-join(A,C) does never completes.
Do you have any tips, suggestions, insights about what might be going on?
DETAILS
I have three layers for a state with successively smaller shapes:
- Congressional Districts (CDs) — order a dozen shapes
- Precincts — order 2,500 shapes
- Blocks — order 300,000 shapes
The CRS for all three layers is EPSG:4269, NAD83. However, the CRS for the Precincts and CDs shapefiles that I got from the state was something else. So, I changed the CRS to EPSG:4269, NAD83 using “Save As …” (per this).
I want to assign Precincts to Blocks and CDs to Blocks, using Vector > Data Management Tools > Join Attributes By Location … Again, I’ve done this kind of operation with many shapefiles successfully, so I believe there’s something subtle going on somewhere that I’m missing.
Vector > Data Management Tools > Join Attributes By Location ... works for
- Blocks and Precincts layer with “Target vector layer” = Blocks and “Join vector layer” = Precincts; and
- Precincts and CD layer with “Target vector layer” = Precincts and “Join vector layer” = CDs
However, it hangs, never completes, for
- Blocks and CDs layer with “Target vector layer” = Blocks and “Join vector layer” = CDs
The first two spatial joins complete relatively quickly, taking no more than a minute or two. The latter, transitive spatial join never completes though. As I said, I’ve let it run for two hours to no avail.
NOTE: The only reason I spatially joined Precincts and CDs was to see if it would work. (It does.) A fraction of Precincts actually span CDs which is why need to do this transitive join.
In the process of making sure everything was set up right, I made the shapes in the coarsest layer (CDs) transparent, so I could see the smaller shapes (blocks) through them, and the align correctly. So, I believe the coordinate systems are set up correctly.
I’m running QGIS 2.8 on Mac OS X 10.11.3 (El Capitan).