-1

I want to simulate the travel path based on data points generated by my farm tractor, which is equipped a GPS receiver (I want to know where it starts and where it ends). Unfortunately the generated data points are not labelled sequential IDs.

In ArcGIS, I have two columns Date and Time on the attribute table that I can refer to as sequence and then use points to lines to generate lines.

Both Date and Time are string field:

enter image description here

Maybe I should combine two columns into one? I've tried few times inputting Time as Line Field and Date as Sort Field but turns out warning001059.

  • Could you please provide an example of your intended output? Have you considered sorting first by date and then by time? Then you can simply reference the OID. pro.arcgis.com/en/pro-app/tool-reference/data-management/… – Aaron Aug 26 '16 at 4:13
  • 1
    @GoldenJiang Could you please edit your question and provide an example of your intended output? – Midavalo Aug 26 '16 at 4:40
  • Question edited. Hope that makes sense. @Midavalo – Gorden Jiang Aug 26 '16 at 5:01
  • If it's a single run a day you can use date as lineid for points to line tool – FelixIP Aug 26 '16 at 5:02
  • Time can be line I'd under no circumstances – FelixIP Aug 26 '16 at 5:12
2

Create a new column with DATE format

enter image description here

Run Field Calculator on it, select Python parser, and enter the following expression:

datetime.datetime.strptime("{} {}".format(!MyDate!, !MyTime!), "%d/%m/%Y %H:%M:%S")

where MyDate is the name of your date field, and MyTime is the name of your time field.

This will populate your new field with the datetime which is sortable.

enter image description here

NOTE: This will fail on the fields with invalid dates like your 2000-00-00 in your screenshot above. You'll need to tidy that data, or select around it when you run the Field Calculator

  • Why my New_Date field only gives dates, no times? @Midavalo – Gorden Jiang Aug 26 '16 at 7:45
  • @GoldenJiang is that on every record, or just some? – Midavalo Aug 26 '16 at 9:27
  • @GoldenJiang is this a Shapefile? Shapefile date fields do not store time. File geodatabase will store the time as shown in my answer. Can the data be converted to file geodatabase first? – Midavalo Aug 26 '16 at 22:11
  • My bad, I didn't put the file in a geodatabase ... Now New_Date contains 10/062016 1:32:30 a.m. etc. But I am getting a list of WARNING001059: Not enough points to create a line for value 2016-05-30 01:58:40. when I run points to lines. @Midavalo – Gorden Jiang Aug 26 '16 at 22:14
  • So I should use New_Date as Sort Field. Great thanks @Midavalo – Gorden Jiang Aug 26 '16 at 23:08

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.