I have two GPS coordinates and a distance from each point. I would like to automate the calculation of the two possible GPS coordinates that will match these constraints.
Any ideas on how to start?
You can use the Turf.js library to perform advanced geospatial analysis in JavaScript. Triangulation is one the many possibilities.
Here is a code example of a triangulation to find the points that match two constraints of distance.
const center1 = [1.56, 44.58];
const distance1 = 127;
const circle1 = turf.circle(center1, distance1, {
steps: 1000,
units: "kilometers"
});
const center2 = [1.89, 44.97];
const distance2 = 89;
const circle2 = turf.circle(center2, distance2, {
steps: 1000,
units: "kilometers"
});
const intersections = turf.lineIntersect(circle1, circle2);
console.log(intersections);
// Outputs: [1.49712, 45.72128] and [3.01305, 45.07238]
Source: https://tzi.fr/js/triangulation/