I am trying to join a CSV file to a shapefile by matching on attributes.

Here is the minimal workflow:

  1. Import shapefile in blank document.

  2. Save attributes of shapefile to CSV.

    2.5 eventually, I want to do some calculations in R here and add some new columns to this table, but at this point, I don't even open the CSV outside of QGIS.

  3. import CSV file to map.

  4. join, using add vector join

joining window

With this procedure, the join works perfectly if I open a blank map document, and DO NOT save it. For reference, the files I'm working with only have a few hundred features, they are not large. When the join works, it's nearly instant on my macbook pro.

However, if I save the map document as something, any time before my step 4 above, then the join simply hangs. I don't get an error, but QGIS simply stops responding, and I need to force quit.

I'm using QGIS version 2.18.7, on a MacBook Pro, running OS 10.12.5. I have been trying to solve this problem for a while, so I've updated everything. For a while, I thought the problem might be related to incompatibilities in the carriage return format, either in my import/export/reimport procedure, or in how QGIS re-imports the file itself, based on some of the comments here: QGIS 2.0 text delimited layer importing data as single row

My open-a-new-blank-document workaround is liveable for now, but why is this happening?

  • did you try to save the shapefile with the joined table as a new file and work with that? – LaughU May 31 '17 at 6:08
  • I'm not sure I understand your question, so here are two answers: Once I get the join to work, I can save the shapefile with the joined data, and it works fine. The other answer: I have opened and resaved the same base shapefile in a completely new document before trying to join, and I still get the same behavior. The research that I'm doing is all happening in step 2.5, but I'd like to be able to quickly and easily go between doing my analysis (in R) and looking at the results on a map. Thanks – Chris May 31 '17 at 12:50
  • If this issue is reproducible, I think it should be reported as a bug. – underdark May 31 '17 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.