Hi, could anyone please help me how to calculate the distance between a specific geographic (GPS) point and multiple points for different IDs. I have pasted the primary output of all the points for IDs and Lat/Long: I would like to calculate the distance from these point to this specific point (Latitude: 22.41235, Longitude: 92.38767).Then I would like to create a matrix of ID, the original Lat and Long and the output " distance from this specific GPS point" in a new column.
structure(list(ID = c("ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID1", "ID2",
"ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2",
"ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2",
"ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2",
"ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2",
"ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2", "ID2",
"ID2", "ID2", "ID2", "ID2"), Latitude = c(22.15733, 22.1508,
22.152249, 22.15686, 22.1508, 22.15184, 22.1521, 22.15516, 22.15137,
22.15838, 22.15078, 22.15932, 22.15942, 22.15937, 22.15732, 22.15527,
22.15733, 22.15148, 22.15244, 22.15702, 22.15511, 22.15876, 22.15866,
22.1557, 22.15813, 22.16191, 22.16227, 22.16226, 22.16121, 22.16535,
22.16563, 22.16495, 22.16256, 22.1625, 22.16497, 22.16335, 22.16464,
22.16512, 22.16542, 22.16342, 22.16568, 22.1635, 22.16104, 22.16323,
22.162557, 22.16102, 22.16245, 22.16227, 22.162321, 22.1614,
22.22376, 22.24522, 22.24535, 22.24435, 22.22383, 22.22381, 22.22362,
22.22351, 22.22343, 22.2234, 22.22359, 22.22376, 22.22391, 22.22401,
22.22384, 22.22348, 22.22711, 22.22711, 22.22681, 22.22649, 22.22692,
22.22708, 22.22656, 22.2266, 22.22708, 22.22718, 22.22744, 22.22727,
22.22391, 22.22448, 22.22446, 22.22624, 22.22674, 22.22651, 22.22611,
22.22617, 22.22599, 22.22418, 22.22637, 22.22424, 22.22392, 22.24445,
22.24411, 22.24395, 22.2442, 22.24396, 22.24539, 22.24363, 22.24279,
22.24419), Longtitude = c(92.3299, 92.32269, 92.32289, 92.33346,
92.32235, 92.3223, 92.3223, 92.32631, 92.32234, 92.3337, 92.324697,
92.33263, 92.33263, 92.33263, 92.32956, 92.33215, 92.3299, 92.32248,
92.3249, 92.33222, 92.33203, 92.3337, 92.33392, 92.33013, 92.33112,
92.34243, 92.34205, 92.34244, 92.34371, 92.34028, 92.3406, 92.34003,
92.34324, 92.34367, 92.33984, 92.34328, 92.34059, 92.37019, 92.34018,
92.34394, 92.34015, 92.34155, 92.34337, 92.34173, 92.34326, 92.3428,
92.34368, 92.34305, 92.34261, 92.34261, 92.27397, 92.28837, 92.28838,
92.28864, 92.27408, 92.27402, 92.27392, 92.27376, 92.27366, 92.27357,
92.27393, 92.27399, 92.27391, 92.27393, 92.27383, 92.27374, 92.27608,
92.27593, 92.27559, 92.27577, 92.27545, 92.27533, 92.27532, 92.27539,
92.27557, 92.27568, 92.27562, 92.27553, 92.18207, 92.18164, 92.18217,
92.18157, 92.18096, 92.18117, 92.18168, 92.18162, 92.18154, 92.1817,
92.18175, 92.1821, 92.18213, 92.28967, 92.2891, 92.28899, 92.28915,
92.2884, 92.28833, 92.28823, 92.288989, 92.28898)), class = "data.frame", row.names = c(NA,
-100L))
ID Latitude Longtitude
1 ID1 22.15733 92.32990
2 ID1 22.15080 92.32269
3 ID1 22.15225 92.32289
4 ID1 22.15686 92.33346
5 ID1 22.15080 92.32235
6 ID1 22.15184 92.32230