I have a .csv file containing (amongst others) some date fields, and a matching .csvt file defining the correct field data types. The only way I have been able to add my .csv data and have QGIS recognise the correct date field is by using:

"Manage Layers Toolbar > Add Vector Layer"

Manage Layers Toolbar > Add Vector Layer

Which gives me this dialog:

enter image description here

After selecting my .csv file and clicking open, the layer appears in the layers panel like so:

enter image description here

All the fields are the correct data types and all the data is present, however nothing displays in the map canvas. I figure QGIS does not know these data are geometry points and so treats the layer as a data table.

How can I get QGIS to render this layer as points on the map canvas?

(Note that adding the .csv file using "Manage Layers Toolbar > Add Delimited Text Layer", which does render correctly, is not an option unless there is a way to make this approach recognise the date fields correctly.)

  • 1
    This might help gist.github.com/rbanick/1e96d77a3f5b8d575945 but only if VRT points recognizes the date data.. Dates can be fairly difficult to import from text. Commented Nov 13, 2017 at 2:04
  • Maybe related: gis.stackexchange.com/questions/32352/…
    – AndreJ
    Commented Nov 13, 2017 at 6:53
  • What kind of problems do you have with the data fields? (when using "Add Delimited Text Layer")
    – AndreasK
    Commented Nov 13, 2017 at 9:13
  • The date fields come in as strings using "Add Delimited Text Layer", and queries don't work properly on them. Keiko has a good response below but I was hoping there was a way to add a CSV layer that would get everything correct in the process.
    – Sangster
    Commented Nov 16, 2018 at 6:35

1 Answer 1


Why are you not using this tool ? enter image description here

By this way, you can choose your format, and specify a geometry column (X;Y) :

enter image description here

Then, you can use an update function using a "to_date" conversion.
If you need, you can use the string functions to formate correctly.

For example :

Column containing your dates (Type = bigint) : dates_int (ex : 20171113)
Destination column (Type = date) : dates

[dates =] 

left(to_string("dates_int"),4) || '-' || 
right(left(to_string("dates_int"),6),2) || '-' || 
right(to_string("dates_int" ),2))
  • Thanks for your response Keiko. Using Add Delimited Text Layer (as you suggested) was my first approach but it results in date fields importing as string types, regardless of the CSVT file. Using `Add Vector Layer' with a valid CSVT file results in the date fields importing correctly but no option to specify the coordinate fields, so the features do not display on the map canvas. The suggestion to use an update function is helpful but is there a way to specify the coordinate fields in a data layer so that QGIS will recognise it as containing geometry and render it to the map canvas?
    – Sangster
    Commented Nov 16, 2018 at 6:29

Your Answer

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

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