AnsweredAssumed Answered

Distance between Points

Question asked by jolive75 on Oct 9, 2014
Latest reply on Oct 9, 2014 by Dan_Patterson

here the thing-

in the same layer, I have POINT_X, POINT_Y and POINT_X_1, POINT_Y_1, as decimal degrees.

I´m trying to find the linear distance in meters from the 2 points.

I´m trying to get it with pyhton, using the below code, but I get always the same syntax error

000989 : Python syntax error: <value>


Any help appreciated





pre-logic code


ef Haversine(Lat0, Lat1, Lon0, Lon1):

[INDENT]dlat = Lat0 - Lat1

dlon = Lon0 - Lon1

a = (math.sin(math.radians(dlat)/2 )*math.sin(math.radians(dlat)/2 )) + math.cos(math.radians(Lat1) )*math.cos(math.radians( Lat0 ) )*(math.sin(math.radians(dlon)/2 )*math.sin(math.radians(dlon)/2 ))

c = 2*math.atan2( math.sqrt(a ),math.sqrt(1-a ))

H = c * 6371

return H





Haversine( !POINT_Y! , !POINT_Y_1! , !POINT_X! , !POINT_X_1! )