Bug report #12144
Clip and intersect do not work on certain vector layers
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Processing/QGIS | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | invalid |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 20338 |
Description
I have seen this reported in the past. Because the shape files are slightly larger than allowed I paste here the links to my shared drive.
I have the following setup:
I want to clip TorontoHarbourBathymetry : https://drive.google.com/file/d/0B5r7QXFf0ZlabmFjNmlUdGFTV3c/view?usp=sharing
with a masking layer TorontoHarbourWaterMaskCorr : https://drive.google.com/file/d/0B5r7QXFf0ZlaQWQyWTdsbG1zZlE/view?usp=sharing
and the result is an empty layer.
TorontoHarbourWaterMaskCorr was edited by me from Toronto_waterfront_water_mask_water: https://drive.google.com/file/d/0B5r7QXFf0ZlaT1hjSmM1SVV2RTQ/view?usp=sharing
When I clip with the original (Toronto_waterfront_water_mask_water) clipping works, but not with the corrected one. I verified the topology and metadata and they look the same (i.e the topology shows some invalid geometry in both)
I tried with ArcGIS and the clipping is done perfectly. The result is here TorontoHarbourBathymetryWater: https://drive.google.com/file/d/0B5r7QXFf0ZlaQWpIVF9HSUR0d1k/view?usp=sharing
History
#1 Updated by Giovanni Manghi over 9 years ago
- Category set to 44
- Status changed from Open to Closed
- Resolution set to invalid
QGIS (the underlying libraries) is known to be less forgiving than arcgis when input layers have geometry issues.
In your case the clip layer has some autointersections and this make the qgis tool to fail. Example:
ERROR 1: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 634635.8444026924 4831683.9208947709 at 634635.8444026924 4831683.9208947709
Of course you clean beforehand your layers and this usually makes the trick. Attached the result after cleaning the clip layer with the tool "make valid" you can find in the processing toolbox after having installed the "Processing LWGEOM Provider". Using grass v.overlay (always available in processing toolbox) does also work in this case usually also with unclean vectors.
The real (long standing) issue here is that the users are usually unaware of the geometry problems. We should add something, as option, to check/clean the vectors on the fly while doing geoprocessing operations (like probably arcgis does). Feel free to open a feature request and/or discuss it in the users/developers mailing lists.
#2 Updated by Giovanni Manghi over 9 years ago
- File clipped.dbf.zip added
#3 Updated by Bogdan Hlevca over 9 years ago
At least you should pop up an error message instead of silently creating an empty layer. By any programming rules this is not right even if the input is bad.
#4 Updated by Giovanni Manghi over 9 years ago
Bogdan Hlevca wrote:
At least you should pop up an error message instead of silently creating an empty layer. By any programming rules this is not right even if the input is bad.
yes, this is why I wrote my last statement in #12144-1
thanks for filing the feature request.
#5 Updated by Giovanni Manghi over 7 years ago
The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.
#6 Updated by Jürgen Fischer about 7 years ago
- Subject changed from Clip and interesect do not work on certain vector layers to Clip and intersect do not work on certain vector layers
- Description updated (diff)
- Regression? set to No
- Easy fix? set to No