Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have been searching and searching and I can't find a particular solution to what I need.

I have a table with animal location points. I need to calculate movement distances between points from the same animal. So I thought I would create lines from the points, which are linked by an animal ID code, then calculate the line distance of each movement - simple right? Not so!

I have a table structure similar to this:

FID; AnimalID; Date; UID; Weight

The AnimalID field links observations from the same animal, the date is the sequential ordering field, UID is a copy of the FID so that each record has a unique ID code and Weight is a measurement of the animal at the time.

Some animals were only located once (these get excluded by the creation of lines so is usually not an issue and I don't want to delete all of the single observations from the dataset every time I run this). The remaining animals are located multiple times.Of note is that some location points are identical for different individuals.

I am using ArcGIS 10.0 w/ spatial analyst extn.

At the end I need to have the following fields in the attribute table (or something like it): AnimalID; Date 1; Date2; Weight1; Weight2; Distance

So I have looked at ETGeowizards Points to Line tool and this is a really good toolset. I specify the ID field as the AnimalID, the order field as Date and it allows me to attach the attributes of the UID field of the start and end point. It is almost what I need. HOWEVER, it creates a single polyline for each animal and I need to have different segments. While I can convert it to multipart, I lose the important attribute information (date, weight) that I can't link back to the original data.

I also tried the point to line tool in Geospatial Modelling Environment (GME) which is also almost suitable. This allows me to create multipart lines with the AnimalID transferred over. However, I can't include a UID field from each point, so I can't join the specific attributes of both points over. I tried to do a spatial join (one to one). However, as I have more than 2 points that overlap with some lines, this causes incorrect attributes to be transferred. A one-to-many spatial join causes replicates of the line (as there are two points to each line), plus the erroneous ones from overlapping points from other animals. It seems a nightmare to try and extract the correct ones from this.

As far as I can see, the Point to Line tool in GME is most appropriate if I could get it to copy a From_UID and a TO_UID fields over. Then I could do a join of the line layer to the original point layer -> export to shapefile -> do another join of the exported line layer with the original point layer (to get the attributes for the second point) -> export shapefile. Then I add a field -> calculate geometry for the distance calculation.

FYI this is what the GME Point to Line tool does: "The tool allows a user to select a field name from the points layer to group the line segments, a field name to sort the groups (optional), and the point layer fields to be copied to the line layer. Line segments are created from two points with the same attribute in the group field. The attributes for the line segment are taken from the first point. The points DO NOT have to be sorted by group attribute and order."

I have no experience writing scripts. But hopefully someone can think of a work-around!

Phew - sorry that is a lot of information!

Thank you all in advance!!

:)

Edit: Thanks, I am used to an older version of ArcGIS, so I used ET Geowizard tools first. But yes, you can do this with the ArcGIS toolset Point to Lines tool. But still can't retain attributes or a to_ and from_ field. Any more suggestions??

share|improve this question
    
With Points To Line and ArcPy cursors this looks relatively straightforward but without Python I would not like to tackle it. I don't see any need for ET GeoWizards, GME or Spatial Analyst and it should all be doable with a Basic/ArcView license. –  PolyGeo May 17 '13 at 8:11
    
can you post a small sample file for those interested in testing out ideas for solutions so we don't have to make up a test dataset as a first step? –  Llaves May 27 '13 at 4:05
add comment

1 Answer

Well I couldn't work out how to tie the original attributes back to the lines in ArcGIS. But I ended up getting the job done in R using the AdehabitatLT package. The instruction manual can be found here: http://cran.r-project.org/web/packages/adehabitatLT/vignettes/adehabitatLT.pdf

Here are the steps:

  • import in data table with animalID; Date; Easting; Northing; variable1; variable2 fields
  • convert date field to a format suitable for AdehabitatLT
  • Create trajectories (movement lines)
  • Convert trajectories to a dataframe
  • Delete out the animals that only had one location points (using subset)
  • Export the dataframe to a .csv for use in a stats package (this has distance and time between relocations in the fields plus the original data)
  • Convert the dataframe back to a trajectory type
  • Export as shapefile of movement lines using the maptools package to view in ArcGIS.

The trajectory lines created using this method for viewing in ArcGIS still don't have the original fields in the attribute table and are just one line per animal. However, the dataframe export into excel gives me the information I need to do the analyses, so it works well enough.

It would be neater if we had this info in the attribute table for each line. But it gets the job done.

I can post the script if anyone is interested.

I'm still interested to hear if I can do this in ArcGIS.

:)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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