3

At 2.18.6, I am trying to use the PointstoPaths plugin.

My input layer has a datetime string field with the following format:

2015-01-25 13:45:50 [Please note the blank between date and time.]

However, the PointstoPaths window displays a date format example of:

%Y%m%dT%H:%M:%S [Here, please note the 'T' between date and time]

Here's a screenshot:

enter image description here

If I use PointstoPaths with the following datetime format (which matches my data):

%Y%m%d %H:%M:%S [with a blank!]

This error is returned:

enter image description here

If I subsequently edit my datetime string field to change the blank to a 'T', the tool executes perfectly. Thus I am led to believe that the 'T' is required. But I don't know what the 'T' represents. A review of the Python datetime web page turned up nothing.

Sorry if this is long winded, but I don't understand the 'T'!

1 Answer 1

3

Actually, you are almost there. In your tested case, the hyphen (short dash) between %Y, %m, %d were missing.

PointsToPath accepts both formats as below (as far as such field is string).

  • If the string is '2015-01-25 13:45:50', the format is %Y-%m-%d %H:%M:%S
  • If the string is '2015-01-25T13:45:50', the format is %Y-%m-%dT%H:%M:%S

For the latter case, the T is automatically added between date and time, replacing the space, when the string is converted to "date & time" type field (like, to_datetime() function). I agree it is a misleading description, because PointsToPaths does not accept date or datetime types.

I think the plugin author tried to emphasize that it can accept '2015-01-25T13:45:50' so that most of us (who store the datetime data in "date & time" type field) can easily use it just by to_string() conversion.

By the way, Points to path geoalgorithm is also available in the Processing Toolbox | QGIS geoalgorithms | Vector creation tools.

2
  • Thanks for sticking with me! I did an experiment: If the input format is 2015-05-31T23:58:59 and in the tool I use %Y-%m-%dT%H:%M:%S, an error is returned. If I use %Y-%m-%d %H:%M:%S, also an error. Thus it would appear that I cannot have a T in the input data. If I replace the T in the data to a blank, 2015-05-31 23:58:59, and in the tool I use %Y-%m-%dT%H:%M:%S, an error is returned. However, if I use %Y-%m-%d %H:%M:%S, success! In summary, my only solution is to have a blank in the data and a blank in the format. This is at odds with my op, so now I am very confused....
    – Stu Smith
    Commented Apr 26, 2017 at 5:31
  • Hi @StuSmith thanks for your feedback. Great to hear that you found a successful combination. At this end I made a few tests on Points to path tool in Processing Toolbox (so this isn't an apples-to-apples comparison to the Plugin, sorry). With QGIS2.14LTR, I could NOT make any paths regardless the combinations (Nothing worked... with T or space). But QGIS 2.18.6 produced paths for both combinations in my answer. This outcome is strange, but it also gives me a hope that you may be able to give a try to Points to path tool as you are using QGIS 2.18.6. (if you can find a time to try).
    – Kazuhito
    Commented Apr 26, 2017 at 8:37

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