I've observed this behavior, too. In my particular situation, I wanted to Join a shapefile of buffered lines with another shapefile of lines, keeping all of the latter lines that fall completely inside the former buffers, and joining the information in the buffers with these discovered circumscribed lines.
The process for the wizard is
- Right-clicking the shapefile of lines
- Choosing Joins and Relates -> Join.....
- Selecting "Join data from another layer based on spatial location"
- Selecting the layer of buffer shapes
- Select "Each line will be given all of the attributes of the polygon that......" and select "it falls completely inside."
The same process in Python code would be:
arcpy.SpatialJoin_analysis (line_layer_file, buffer_layer_file, output_file, "JOIN_ONE_TO_ONE", "#", "#", "COMPLETELY_WITHIN")
Whether I run the Python version as python code or in the model builder, I get the same results . . . both of which contain seemingly random entries! There are entries included that are definitely NOT completely within the buffer. They overlap the buffer, but are not completely within it. And in fact, other lines that lie completely within the buffer can be overlooked in favor of one that only intersects/overlaps the buffer. This erroneous performance is corrected when using the wizard.
I know I remember finding a post, either in this forum or another, that this occurrence is a known issue. But I cannot find it now.
PS. There is no error message for me--both run to completion--but the results are incorrect.
Not a very useful error message is it!
Firstly, lets see if we can do something about that.
You can check the QGIS log panel. (Right click on tool bar > Log Messages Panel) This may give you more context to the error.
We probably need more information about how you are doing this task to diagnose it, but to your specific question:
It is possible that there are some geometry errors in your dataset. Run the 'Check Validity' tool first on each dataset. Also run the Fix Geometries.
Also just do a sanity check on the geometry - is there a polygon record that has a large number of vertices? Its possible a really complex geometry may cause the process to chew on memory. However my personal experiences with QGIS and memory overuse, is that it doesn't throw an error, it just freezes or becomes non-responsive, so I don't think it is this.
So its going to be geometry. Try Differencing and merging single datasets at a time, such that you can pinpoint the problem to a specific dataset. Then you can run fixes/checks across a single dataset. Also check those logs I mentioned above!
Update
Ironically - 18 months after answering this question - I got this error message myself today - only 2 datasets involved
One of the source datasets was the result of a 'Merge Vector Layers' operation. This looks like it kept all the fid values and didn't invoke an error. But now - using other tools (I tried exporting the layer to new geopackage), QGIS throws "Feature creation error (OGR error: failed to execute insert : UNIQUE constraint failed: fixed_geometries.fid)" I got around this by exportin the layer out to a new layer (deselecting the existing fid so new ones got created).
BUT - this still didn't fix the problem.
The other dataset in question, as the result of some dissolving operations. It had dissolved all records into multi-part geometry records (about 150 records down into 2 records). I decided to perform a multi-part to single-part operation.
Once I did this, the Difference tool worked successfully. The error in question is so generic, that the solution could be one of many, but the above shows that it may be a result of various problems with your input data.
Best Answer
I get the same error. How to solve the problem:
And here you are with the difference-points you want.