Calculate distance between multiple locations

I have a project list table that contains a coordinate column (lat/lng), so I want to find projects that are less than 100 meters apart.
Thank you for helping

So you mean you need some sort of a matrix of distance between each pair of location to see which pairs are less than 100 meters apart?

I was intrigued and went over to ChatGPT. Not sure if this helps:

distance = 2 * 6371 * ASIN(SQRT(POWER(SIN((lat2 - lat1) * PI() / 180 / 2), 2) + COS(lat1 * PI() / 180) * COS(lat2 * PI() / 180) * POWER(SIN((lon2 - lon1) * PI() / 180 / 2), 2)))

There’s already a column type to calculate distance. I think the question is more about calculating distance from what to what?


I think the question is about all the sporadic points and determining which points have a distance between them of less than 100 meters. This would be easier if visualized with radius circles around all the points on the map. This requires advanced calculations.

yes exactly
but maybe more than 2 match

How would you view this in the app? Would you open a project first and then want to see a list of other projects within 100 meters of the project you are viewing?

1 Like

We have a table that contains many project(rows) and thay have X,Y cordinate.
I want to compare those by distance and if thay had less than 100 meters distance together then show those

So it has to be shown pair-wise in a list, and not like what Jeff described here?

1 Like

Well, we can do this too.
Also, can we make the user input the variable distance(e.g.100,50,…)?

I think you can do it like Jeff said:

  • On entry to the project, set the address of the project to a column in your user profiles.

  • Use a distance column to calculate the distance from each of your projects to the address above. I think you want to return kilometers here. Add a math column to convert it to meters by multiplying 1000.

  • Add another column to store the variable distance in the user profiles table, add a number entry column for the user to write to that, make sure they know they’re writing in meters.

  • Add a filter in your projects collection to filter the meter distance to be less than or equal to the user’s input.