[GIS] Clip line vector by shape fails – error 1005

clipqgis

I'm experiencing problems with the Clip tool in QGIS 2.18.1.

I'm trying to clip the intersection between some polygons and lines from another shapefile.

Every time, I get a "1005 error". I tried to read the logs, but I'm not familiar enough to solve this.

Both of my shapefiles are in the same projection, and have been cleaned (GRASS v.clean).

Here is the log of the process:

Uncaught error while executing algorithm
Traceback (most recent call last):
File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\core\GeoAlgorithm.py", line 203, in execute
self.processAlgorithm(progress)
File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\algs\qgis\Clip.py", line 71, in processAlgorithm
source_layer.crs())
File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\core\outputs.py", line 326, in getVectorWriter
crs, options)
File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\tools\vector.py", line 610, in init
uri = GEOM_TYPE_MAP[geometryType] + "?uuid=" + unicode(uuid.uuid4())
KeyError: 1005

EDIT:
It would seem that the problem comes from my line shapefile, as the process works with another file. How can I identify what's causing the problem with these infos?

FINAL EDIT:
As Steven Kay pointed out, the error code expressed that my geometry was MULTILINESTRINGZ, which was not supported by the Clip for some reason. By using the "Convert geometry type" tool from QGIS's Geoprocessings, I could convert the geometry to LINESTRING and finally do the Clip.

Best Answer

from looking at that error, I see one (or both) of your layers is geometry type 1005 which corresponds to MULTILINESTRINGZ.

Processing seems to be maintaining its own lookup table of geometry types. The array hasn't been set up with an entry for this geometry type, which is why you're seeing the "key error:1005".

I found a fairly recent commit which changes this, so it might be worth upgrading to 2.18.2 to see if that improves things.

Sadly, I don't have any files with that type of geometry to test on

EDIT

If upgrading doesn't work, you might be able to convert from MULTILINESTRINGZ to MULTILINESTRING25D (using ogr2ogr?) as that geometry type IS in the array. (I believe this will cause the z values to be ignored, though). It could well be that clip doesn't support MULTILINESTRINGZ, which may be why it wasn't there in the first place.

Related Question