1
votes

How do i identify if a point with a LAT, LONG coordinate format is near to other point.

Lets Say i want to find all the points near to:

-38.9086621 ,-68.082214

That are at less than 1km of distance. I already know how to find a coordinate in a given quadrant but not how to find a quadrant near a point.

1
If you need precision you should transform the geographic coordinates to a metric reference system (Such as EPSG:3857) and then you can use simple maths. You can take a look at proj4js (proj4js.org).Marc Compte
@MarcCompte What kind of precision improvement you reach doing this in measuring a distance? In geodetic works angles or distance measurements, compensations, error in measurements, ... are done preferible in global coordinate system such as ECEF to avoid having errors about reference frame.Jose Hermosilla Rodrigo
@JoseHermosillaRodrigo We talk about distances. A distance between two points is a measure on a plane. The geographic coordinates are three dimensional. There is no other way to calculate metric distances other than to convert from a 3D to a plane. Of course you can use basic trigonometry to do so, but then you are assuming the earth is a perfect sphere, and this will rarely be as precise as using an ellipsoid (a more complex approximation to the earth 3D shape). That's the reason why transformation is key to achieve a high precision distance calculation, other than using laser measurements.Marc Compte

1 Answers

0
votes

You can use the haversine formular to calculate distances between two given coordinates. The calculated distance is the direct connection between the given coordinates (beeline).

JavaScript example (Source):

var R = 6371e3; // meters
var lat1Radians = lat1.toRadians();
var lat2Radians = lat2.toRadians();
var deltaLat = (lat2-lat1).toRadians();
var deltaLon = (lon2-lon1).toRadians();

var a = Math.sin(deltaLat/2) * Math.sin(deltaLat/2) +
        Math.cos(lat1Radians) * Math.cos(lat2Radians) *
        Math.sin(deltaLon/2) * Math.sin(deltaLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

var d = R * c;