2

I am having trouble clipping a point shapefile to with a polygon shapefile in QGIS 2.18.2. I was able to clip a point shapefile from a different source successfully (using the same polygon) so I think the point shapefile is the issue. I also tried the intersect tool but both provided the same message in the log:

"Algorithm clip starting...

1004 See log for details"

The presumably problematic data was downloaded as a KML file from:

http://ucjeps.berkeley.edu/cgi-bin/get_consort.pl?county=&source=&taxon_name=camissonia%20campestris&collector=&aid=&year=&month=&day=&loc=&coll_num=&max_rec=2000&make_tax_list=&before_after=&last_comments=&VV=&non_native=0&geo_only=&geo_no=&CNPS_listed=0&weed=0&sugg_loc=&tns=&lo_e=&hi_e=&YF=0&VTM=0&baja=0&georef_only=1

One difference that is apparent between the two shapefiles is that the one that works has a normal, complete attribute table, while the problem shapefile has an attribute table that looks like this:

enter image description here I converted the file to shapefile in QGIS but both the KML and shapefile attribute tables look the same.

If this is the reason I can't clip this shapefile, is there is a way to get the KML file to show the attribute data properly?

If this issue can't be resolved for this file, the data can also be provided as a tab separated list, however, I am having issues getting this into a usable form (or I wouldn't be asking this question), so I will post a separate question to resolve that problem if necessary.

3
  • Did you convert the original data as downloaded (before clipping) into a shapefile? Or would the original data likely exceed the 2GiB maximum size for a shapefile. Jun 28, 2017 at 21:32
  • You say you can get the table as TAB delimited text, the KML from that page only has a description field but contains a reference that may be able to join the table if the SpecimenID can be separated out. Is that table publicly available? if so do you have a link so I can see it... Jun 28, 2017 at 21:39
  • Sorry for the delayed response, I forgot to check the 'send to email' box; I did convert the KML to a shapefile before clipping (the attribute table is messed up with the original KML file, in case that matters). The TAB separated list format can be downloaded from the link provided, on the upper right hand side under 'Download Options:'
    – ia200
    Jul 12, 2017 at 17:06

2 Answers 2

3

I believe that you have found some bug and I could reproduce the error by opening the KML file with QGIS 2.18.10.

This is what I find from the logs:

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

However, if I press the "Iterate over this layer" button of the clipping layer the process runs without errors. I do not know what is the meaning of that button but at least for me it makes the process to succeed.

enter image description here

For me the attribute table was not empty but I had meaningful strings in the description field.

2
  • So your attribute table was correct in the KML file that you downloaded? I'll try your suggestions and report my results.
    – ia200
    Jul 12, 2017 at 17:08
  • I tried using the "Iterate over this layer" button and while it did run the clip without error, no temporary shapefile appeared under my layers panel or in my work area. I repeated this several time, both leaving the "Clipped" box blank, and giving it a specific name. The "Open output file..." button was checked. When I attempted to perform the clip without checking the "Iterate..." button I received the same 1004 error as before. I was able to successfully clip using different input and clip layers so again, this error seems specific to the KML file.
    – ia200
    Jul 12, 2017 at 17:29
0

There are probably geometry errors in the point file. Try exporting the point layer to csv using MMQGIS tool "Geometry Export To CSV" and fix or remove any data that comes up without a valid geometry. Then reload the data and try again.

3
  • 2
    Geometry errors in the point file? I doubt that's possible. Lots of other potential issues
    – Vince
    Jun 28, 2017 at 23:48
  • I had no trouble exporting to a shapefile but there are simply no attributes in the KML like the table shown. Jun 29, 2017 at 1:14
  • It has happened to me several times in QGIS. and I have used that process to find and correct them.
    – Kingfisher
    Jun 29, 2017 at 13:49

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.