1

-Using QGIS 3.2-

I am trying to join 110 different CSV's with the corresponding shapefiles. I started to use the 'Join Attributes by Field Value' batch process to quickly do this. First, is there any way to have an autofill when using only 1 shapefile? Or to autofill the Yes/No question on 'Discard records', the only thing that allows an autofill is the export option.

But the issues is that when selecting the folder of various CSV, it imports the data as string not integer, which then creates issues later with 110 shapefiles, as you can't use Graduated symbology. The only way I have found to solve this is to use the 'Add Layer-Delimited Text Layer' which then works fine and imports them all as integers, but this only allows 1 input and then doing each csv before running the batch process.

Any suggestions would be useful or quicker ways to do this. I have tried with Modeler but can't find a way to import the CSV's without the same issue. I have also tried to Merge all the CSV's beforehand, though having some issues with Pandas [https://stackoverflow.com/questions/23343919/how-do-i-merge-two-csv-files-based-on-field-and-keep-same-number-of-attributes-o]

Ultimately I would like 1 shapefile with all the columns of the 110 CSV linked to it.

  • Ha.. yes. QGIS 3.2 – William Ruzek Jul 17 '18 at 14:03
  • If you are on Windows, you can use command type *.csv > new.txt to merge all the csv files in a folder. Then rename new.txt to new.csv. (or, create the new file in a different folder). – Kazuhito Jul 17 '18 at 14:22
0

To fix your data type issue create a csvt file with the column types, see: https://anitagraser.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/

There is a limit for the number of columns in the attribute table for shape (dBase) format, the maximum number of columns is 254. You had better to use the GeoPack format (which is the default in QGIS 3.x).

If you are on linux you can use paste shell command to put all the csv files into one (if the order of rows is the same in all files or you have to sort them). See: https://www.geeksforgeeks.org/paste-command-linux-examples/.

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.