Select to view content in your preferred language

# calculate distance between 2 GPS point from 2 deferent Tables with the same name

618
1
08-27-2023 02:34 PM
Labels (2)
New Contributor

hi all,

i have Table A and Table B with GPS Dataset, i tried to calculate die Distance between the Point between Table A and Table B wich have the Same ID. im not fimilar with Arcpy, maybe can some one help me to write a code .

with near function my searchcursur i can not change edit the table.

Table A

ID   |         GPSLAT      |      GPS LONG

1   |           X1_1         |              Y1_1         |

2   |            X1_2        |             Y1_2           |

3   |            X1_3        |             Y1_3           |

Table B

ID   |         GPSLAT      |      GPS LONG

1   |           X2_1         |              Y2_1         |

2   |            X2_2        |             Y2_2           |

3   |            X2_3        |             Y2_3           |

Tags (3)
MVP Esteemed Contributor

I just have arcade code but it gives you the math.

Current point distance from design (meters)

# convert from Web Mercator to WGS84 - if you need it
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Geometry(\$feature).x / originShift) * 180.0;
var lat = (Geometry(\$feature).y / originShift) * 180.0;

lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);

return Round(Acos(Sin(lat * PI / 180)*Sin(\$feature.DesignLat * PI / 180) + Cos(lat * PI / 180)*Cos(\$feature.DesignLat * PI / 180)*Cos((\$feature.DesignLong * PI / 180)-(lon * PI / 180))) * 6371000,2)

Other idea is make then XYEvent layers then just let Arc do the math.