I apologize for the redundancy of this issue, but I have explored all the information I could find over the past couple days and have yet to find a solution to what seems to be a very simple task.

I am attempting to clip a larger landscape layer to a smaller clip layer in QGIS. The resulting layer contains the attribute column of the source layer, but no features. I have run the geometry validity test on both layers with zero errors returned. I have ensured both layers are of the identical CRS. I have experimented with expanding the extents of the clip layer to overlap those of the landscape layer. Everything I have tried results in the same empty layer. The same issue exists when attempting to perform the intersection operation. After experimenting with other layers, I have determined the issue to be with the landscape layer and none other. HERE is a link to the project files so anyone may explore them further.

EDIT: I took another look at the OGR error log and it repeats the error: "Feature geometry not imported (OGR error: Attempt to write non-polygon (GEOMETRYCOLLECTION) geometry to POLYGON type shapefile.)" for what I presume is every feature to be created in the clip output, but is not due to whatever this error means. Anyone care to shed some light on this?

  • Can you check what the geometry type of all your features in both input files are? – bosth Sep 27 '15 at 15:30
  • Yes... They are both polygon layers. – GSHinks Sep 27 '15 at 15:31
  • I may have misinterpreted your request. Are you implying there can be mixed-geometry type layers? How can I check? – GSHinks Sep 27 '15 at 18:05

It's possible that you didn't run the Clip tool correctly. I used the following settings:

Clip tool

This produced the correctly-clipped output.

There were a few errors reported by GDAL/OGR in terms of creating some geometries based on the inputs, so I'd recommend checking the messages by clicking the small speech balloon at the bottom right of the QGIS window to see if you have anything different.

GDAL/OGR error messages

  • Wow, that's very interesting! That is the way I tried initially and reverse just to see what would happen both with an empty shapefile as a result. I too received the gdal errors, but I've found that not uncommon, especially with some of these complex polygons. What setup are you using? I am on Windows 7 64-bit running qgis version 2.10.1. I wonder if this could be a problem with a gdal/ogr version? – GSHinks Sep 27 '15 at 1:29
  • Also, gdal/ogr version stock with Pisa is 1.11.2 – GSHinks Sep 27 '15 at 1:37
  • I took a closer look at the error log and you are correct there is an issue there; seems ORG related. Main post updated with error information. – GSHinks Sep 27 '15 at 2:06
  • I am using GDAL 2.0 and perhaps it or the version of GEOS that I have handles the geometric computations differently. – bosth Sep 27 '15 at 4:49
  • Are you certain QGIS is using GDAL 2.0? As far as I can see the latest incorporated version is 1.11.2. I ensured all versions of GDAL and GEOS are the most current and nothing has changed. I've further reproduced this same problem in both the 64-bit and x86 versions of QGIS 2.10 as well as 2.6 – GSHinks Sep 27 '15 at 13:46

I've found a workaround. For some reason, manually copying and pasting all features from the problem "Landscape" layer I was attempting to clip from to a new, empty shapefile fixed something. Using the new duplicated shapefile containing all the original features pasted from the source layer resulted in the clip procedure completing as expected. This, however, does not address the reason why. It is possible there may be a bug in the GDAL/OGR driver for the windows 32 & 64 bit versions.

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.