How can I compute the distance below spark dataframe between Location A and B and Location A and Location C?
spark = SparkSession(sc)
df = spark.createDataFrame([('A',
40.202750,29.168350,'B',40.689247,-74.044502),('A',
40.202750,29.168350,'C',25.197197,55.274376)], ['Location1', 'Lat1',
'Long1', 'Location2', 'Lat2', 'Lon2'])
So the dataset below:
+---------+--------+--------+---------+---------+----------+
|Location1| Lat1| Long1|Location2| Lat2| Lon2|
+---------+--------+--------+---------+---------+----------+
| A|40.20275|29.16835| B|40.689247|-74.044502|
| A|40.20275|29.16835| C|25.197197| 55.274376|
+---------+--------+--------+---------+---------+----------+
Thank you