2

I'm trying to use the graphical modeler to make a join between a vector point layer and a CSV file which doesn't have geometry data.

I tried to use 'Vector layer' as an input for the CSV-file but the .csvt-file is not taken into account and the resulting vector layer is incomplete.

How can we upload a CSV as a delimited text layer with the graphical modeler?

1
  • 1
    I was able to use a CSV as input by Vector Layer normally, maybe it's the type of data you're trying to join. Could you add a print of your model and data? Dec 12, 2019 at 10:11

1 Answer 1

1

If I understand your question, you cannot perform the join because the format of the CSV file (specified in the csvt) is not taken into account.

You should import the CSV with the 'Vector layer' input (as you did). The fields of this file have String type.

Now, let's say you want to join the CSV table with a vector layer on a integer field called "point_ID".

You should thus use a 'Refactor fields' on the field "point_ID" of the CSV table to convert the value from String to Integer and then perform the join. In the Refactor fields tool you have to do 3 things:

  1. Create a field that has a different name than the field of interest ("point_ID"). Let's call it "point_ID_int". This step is very important.
  2. The value of the field is set to: to_int("point_ID") (If you want to convert it in the integer format).
  3. The destination format has to be integer as well.

You also have to refactor the other fields that are important for your calculations.

See picture below for an illustration:

enter image description here

1
  • Thanks a lot. Refactor fields was the solution. Thank you very much! May 5, 2020 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.