Select to view content in your preferred language

GPS data - points to line loose information

1085
7
Jump to solution
04-13-2014 03:56 AM
Johniefromtherock
Deactivated User
Hi

Probably wrong place to post, but I gave figuring out the logic behind the forum.

I have a dataset of GPS data from a collar that was on a Red deer for a few months. This is point-data logged with a interval on 1 hour.
I use an iterator (row selection) to get the relevant data out and transform it to a line using Point To Line tool.
Now i want to find out where the door crosses some roads. For that i use Intersect tool and get all crossings as points.

All well so far.

Now the problem is I need to get the time, or at least some time interval, for that crossing. When i transform the points to line all the relevant data i obviously lost.

Any inputs I can try out?

Thanks a lot!

Mathias
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RichardFairhurst
MVP Alum
Hi

Probably wrong place to post, but I gave figuring out the logic behind the forum.

I have a dataset of GPS data from a collar that was on a Red deer for a few months. This is point-data logged with a interval on 1 hour.
I use an iterator (row selection) to get the relevant data out and transform it to a line using Point To Line tool.
Now i want to find out where the door crosses some roads. For that i use Intersect tool and get all crossings as points.

All well so far.

Now the problem is I need to get the time, or at least some time interval, for that crossing. When i transform the points to line all the relevant data i obviously lost.

Any inputs I can try out?

Thanks a lot!

Mathias


Time can be stored in the M value of the line in a numeric form at each original node.  You should make the M units decimal days, which is the underlying numeric format behind a file geodatabase date field.  The base 0 day and time of a file geodatabase date time field is 12/30/1899 - 12:00:00 AM.  If your time data is first stored in a file geodatabase datetime field then you can use the Field Calculator to calculate that date time field into a double field (just set the calculation expression as the date field).  The date will be converted to decimal days in the numeric field.  When that number is calculated back into a real date time field it will give the correct date and time.  As a decimal day value it will be possible to interpolate the date time at positions between points in the M values when you use the Intersect tool.  The time interpolations will assume a linear rate of speed between any two points, which is an assumption you have to make anyway.  Give the name "MEAS" to the field holding your numeric representation of your date time field.

Create an X/Y event layer from your data using the correct projection for your X/Y coordinates (if you already have the points do the next step to M enable the points).  Use the Feature Class to Feature Class tool to convert the events to a point feature class, but before you run that tool adjust the environment settings for the M values to Enable M values and apply an M resolution of .000001 and an M tolerance of .00001.  These settings should be sufficient to report rounded decimal seconds.  You can add more decimal places to the resolution and tolerance, but that won't really be increasing the accuracy of the measures at any position between vertices, since you need to keep in mind that those measures are just an interpolation.

Now run the script below to assign the numeric date time representation held in the MEAS field to the M coordinates of the points you have converted.  Store the script below in a python file (a text file with the extension of .py) and adjust the workspace path and feature class (fc) name in the script below to match your data.  Then double click the script to run it and assign the MEAS values to the M coordinates of your points.  (By including the "SHAPE.Z" field and the name of a field holding a Z value in the field list you could also apply an elevation to the points the same way).

import arcpy from arcpy import env env.workspace = r"C:\Layers\TESTING.gdb"  fc = "Test_M_Calc"  rows = arcpy.da.UpdateCursor(fc, ["SHAPE@M", "MEAS"]) for row in rows:     row[0] = row[1]     rows.updateRow(row)  del row, rows


Now run the Points to Line tool with the environment set to use the input M value settings (the default environment setting).  Your line will be created with the M values preserved in the line vertices from the points.

Now you can run intersect of your animal track line against your roads.  Create a new date time field in the intersection point output called Crossing_Date and use the Field Calculator to calculate the date into it from the point's M value:

Parser: Python

Expression:  !Shape.FirstPoint.M!

That should cause the Crossing_Date field to report the interpolated date and time when the animal crossed the road for each crossing point.

View solution in original post

0 Kudos
7 Replies
T__WayneWhitley
Honored Contributor
Sounds like you're heading in the right direction - been a while since I've done such a thing, but I'd create a route event out of your line and 'calibrate' it with your points since that's your time data.  With this preparation you can figure out the interpolated point-in-time event of road crossings - you will, of course need the point intersections of those crossings which it sounds like you already have.

All of this is part of the Linear Referencing toolset.  Interesting problem!


Wayne
0 Kudos
RichardFairhurst
MVP Alum
Hi

Probably wrong place to post, but I gave figuring out the logic behind the forum.

I have a dataset of GPS data from a collar that was on a Red deer for a few months. This is point-data logged with a interval on 1 hour.
I use an iterator (row selection) to get the relevant data out and transform it to a line using Point To Line tool.
Now i want to find out where the door crosses some roads. For that i use Intersect tool and get all crossings as points.

All well so far.

Now the problem is I need to get the time, or at least some time interval, for that crossing. When i transform the points to line all the relevant data i obviously lost.

Any inputs I can try out?

Thanks a lot!

Mathias


Time can be stored in the M value of the line in a numeric form at each original node.  You should make the M units decimal days, which is the underlying numeric format behind a file geodatabase date field.  The base 0 day and time of a file geodatabase date time field is 12/30/1899 - 12:00:00 AM.  If your time data is first stored in a file geodatabase datetime field then you can use the Field Calculator to calculate that date time field into a double field (just set the calculation expression as the date field).  The date will be converted to decimal days in the numeric field.  When that number is calculated back into a real date time field it will give the correct date and time.  As a decimal day value it will be possible to interpolate the date time at positions between points in the M values when you use the Intersect tool.  The time interpolations will assume a linear rate of speed between any two points, which is an assumption you have to make anyway.  Give the name "MEAS" to the field holding your numeric representation of your date time field.

Create an X/Y event layer from your data using the correct projection for your X/Y coordinates (if you already have the points do the next step to M enable the points).  Use the Feature Class to Feature Class tool to convert the events to a point feature class, but before you run that tool adjust the environment settings for the M values to Enable M values and apply an M resolution of .000001 and an M tolerance of .00001.  These settings should be sufficient to report rounded decimal seconds.  You can add more decimal places to the resolution and tolerance, but that won't really be increasing the accuracy of the measures at any position between vertices, since you need to keep in mind that those measures are just an interpolation.

Now run the script below to assign the numeric date time representation held in the MEAS field to the M coordinates of the points you have converted.  Store the script below in a python file (a text file with the extension of .py) and adjust the workspace path and feature class (fc) name in the script below to match your data.  Then double click the script to run it and assign the MEAS values to the M coordinates of your points.  (By including the "SHAPE.Z" field and the name of a field holding a Z value in the field list you could also apply an elevation to the points the same way).

import arcpy from arcpy import env env.workspace = r"C:\Layers\TESTING.gdb"  fc = "Test_M_Calc"  rows = arcpy.da.UpdateCursor(fc, ["SHAPE@M", "MEAS"]) for row in rows:     row[0] = row[1]     rows.updateRow(row)  del row, rows


Now run the Points to Line tool with the environment set to use the input M value settings (the default environment setting).  Your line will be created with the M values preserved in the line vertices from the points.

Now you can run intersect of your animal track line against your roads.  Create a new date time field in the intersection point output called Crossing_Date and use the Field Calculator to calculate the date into it from the point's M value:

Parser: Python

Expression:  !Shape.FirstPoint.M!

That should cause the Crossing_Date field to report the interpolated date and time when the animal crossed the road for each crossing point.
0 Kudos
Johniefromtherock
Deactivated User
Thanks to both of you.

I sure got something to work with, but I haven't solved the problem just yet.

I've got a point shape file and a line shape file.

When I convert my point into a line I seem to loose all information. It comes out as one single polyline and when i run the different tools I only get information from the point shape file into the newly formed polyline file to that single attribute.

I will upload some data, and if you feel like taking a look at it you're welcome 🙂

They're in a 14mb file on dropbox. https://www.dropbox.com/s/sokprb3615fo4ym/Deer1andRoads.rar


When I try the second solution, with the M enabled and a field that contains a unique time identifier I cant get a value for the single line segments which I could then use to identify the crossings.

Thanks, I'll keep looking into it.
0 Kudos
RichardFairhurst
MVP Alum
When I try the second solution, with the M enabled and a field that contains a unique time identifier I cant get a value for the single line segments which I could then use to identify the crossings.


If you can get an ID to identify crossings for the first approach then you can get it for the second.  It is the same points you are using for the first approach.  The only difference is that the M values exist prior to using the Points to Line tool.

You use the same Line ID as the value to create the line with the Points to Line tool as with any other approach.  The time field is unimportant at that stage if have already made a set of points with your line ID and M values.  The time field is dropped when you create the line, but the time values are preserved in the M coordinates of the line.  The intersect preserves the Line ID and the M values.  You then recreate the date field after the intersect and use the calculation to get the date time back associated with your line ID at each crossing.  It did not occur to me that you could misunderstand that part of the process.

I gave you a solution that works.  Go back and retry it with these additional instructions.
0 Kudos
RichardFairhurst
MVP Alum
Just to be clear.  With my method you will build an identical set of track lines to the set you have already built, except that the lines will be Polyline M lines, not just plain Polylines.  They will have the same Line ID field as the only field as the lines you already built and on the surface should appear no different from the track lines you already have.  However, in reality these lines will have an M value at every vertex derived from the M values previously calculated to the GPS points.  Those M coordinates preserve a numeric representation of the datetime of every line vertex derived from the points.

The intersect tool will preserve the LineID value of your lines, like it already did in your previous processes, and the only difference is that it will also have interpolated the M values where it intersects your roads.  After the intersect you can create a new date time field on the intersected points and calculate the M value into it to determine the date and time of the crossing.  These points will then have the LineID value of the intersected line and date time of the crossing.
0 Kudos
Johniefromtherock
Deactivated User
GREAT!

I managed to get the values out for each crossing. Of course as the MEAS value, but converting that to a date and time should be trivial. I hope 🙂

Thanks a lot.

Help has been greatly appreciated.
0 Kudos
RichardFairhurst
MVP Alum
GREAT!

I managed to get the values out for each crossing. Of course as the MEAS value, but converting that to a date and time should be trivial. I hope 🙂

Thanks a lot.

Help has been greatly appreciated.


It is trivial.  Just calculate the MEAS number into a date field and it will be displayed as the crossing date time.  Numbers can be directly calculated into date fields and date fields can be directly calculated into double fields if you use a VB Script Field Calculation that just calculates a field of one type into a field of the other type.
0 Kudos