very new to scripting and I have been struggling with my script for a while. I'm not sure why it doesn't work in field calculator. I am trying to calculate a list of distance between two long lat points. The following is the code that I have implemented in the Pre-Logic Script Code for FieldName1. I am currently using ArcGIS 10.1
def Distance(Latitude, Latitude2, Longitude, Longitude2) Longitude, Latitude, Longitude2, Latitude2 = map(math.radians, [Longitude, Latitude, Longitude2, Latitude2]) dlong = Longitude2-Longitude dlat = Latitude2 - Latitude a = math.sin(dlat/2)**2 + math.cos(Latitude * math.cos(Latitude2) * math.sin(dlong/2)**2 c = 2 * math.asin(math.sqrt(a)) Distance = 6371 * C * 1000
The following are sample points for reference: Latitude :48.5761 Longitude : -124.31111 Latitude 2: 48.57611 Longitude 2: -124.31111
I kept getting error 000989: Python syntax error: Parsing error SyntaxError:invalid syntax(line1). It also adds that the parameter are not valid.