Calculating distance between consecutive points using ArcGIS Desktop using Python in Field Calculator?

5713
7
09-16-2016 10:56 AM
bobcostanza
New Contributor II

I can't get the following to work for me. It's exactly what I need!

Finding distance between consecutive points using ArcGIS Desktop? - Geographic Information Systems S... 

I have access to  desktop 10 and 10.4, I have tried it on a couple different shapefiles and get vague error messages.  Does the coordinates system matter?  does the name of the field matter?  My understanding is if I paste the code in the right places and choose python as the parser I should get the distances between the points in my shapefile.

The data points are the location of eagles 

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus
0 Kudos
bobcostanza
New Contributor II

Thanks for the quick reply Dan.  I recognize your name from spending time on the forum in years past.

I am thinking the coordinate systems is the problem.  I believe it's in WGS 84, a geographic coordinate system vs. a projected system.  Do you agree that would be a problem?  Would I have to project it, do the calculation, and project it back again?  I am working with data in the midwest US up into Canada.  Coordinate systems give me a headache trying to wrap my brain around them and wondering what the repercussions are for data being in one or another.  

I don't have the shapefile here but I'll try it on another one.

0 Kudos
bobcostanza
New Contributor II

I tried the interpoint distance equation from the link you sent on a shapefile and it worked--the second time I tried it.  No idea what I did differently. On Monday I will try it on the shapefile I actually need the distances for.

Thanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

To make any sense of the distances, use projected data, that is an implicit assumption of distance measures since 'X' degrees is a pretty useless measure of distance without knowing location on a spherical body (eg think of the 1 degree 'distance' at the pole vs the equator. the results are indeed equal, but do not translate to euclidean space without transformation)

EDIT

If you are working with large interpoint spacing and you feel a geodesic calculation might yield a better result, then the function could be repurposed to do so.  However, if it is relative distances within a group that is important then an appropriate projection would probably suffice.  If memory serves Albers is often used to handle continental scale projections, particularly those with a large EW extent... Lambert conformal conic in canada.  If the extent is largely NS and the points fall with the same UTM zone, then that would probably suffice (EW extent about 6 degrees give or take about 1.5 degrees on either side).  Others could weigh in if they have comparative data to help you make a decision.

0 Kudos
bobcostanza
New Contributor II

Dan,

I have been using the measuring tool to get distances between points,

distances are from under a mile to over a hundred. Why is it that I need a

projection now--other than for the Python script to work?

Thanks,

Bob

0 Kudos
bobcostanza
New Contributor II

Dan,

Once I projected the layer both your Inter-point distance and the angle

between successive points scripts worked.

Thanks a lot.

My next question is how I get bearings N, NE, NW,etc? Can the azimuths be

converted? Are they inter-point azimuths like the distances?

Thanks again,

Bob

0 Kudos
DanPatterson_Retired
MVP Emeritus

Is the question still unanswered?

0 Kudos