Lat/Long Distance

Hi all,

I have a list with 3 columns (cities + lat/longs). I want to go through all the cities and identify out of the list which city is the closest one to which. Ideally I’d like to do this in Java.
Could you help?
Many thanks

Hi @iCornerstone , I don’t know if Java has its own librairies for lat/longs, but I created a component a while ago that calculates distances between sets of lat/long using the Haversine formula, and if I remember correctly, I basically applied the formula via the Math node.

Here’s the component:


thanks Bruno, this is helpful, however the main difficulty I am having is getting for each row the closest point from the other rows

Hi @iCornerstone , may be if you share some sample data and explain what you expect as results for the sample data, we (the community) can help