-1

Is there a way to do high-fidelity trilateration in R (naturally, I'll be using latitudes and longitudes)?

I'm not looking to solve a specific problem, but rather identify tools that are capable of doing this. To my knowledge, classic packages like geosophere sf and sp don't have this capability. Robert Hijams made his own implementation at Calculating intersection of two Circles, but the output of geophere lon/lats only go out to 5 decimal places, whereas I would like something that has 6 decimal places.

For those looking for background on trilateration, here is simple intro.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Aegis
  • 119
  • 5
  • 1
    For software recommendations there is the [softwarerecs.se] Stack Exchange. – PolyGeo Jan 22 '24 at 22:24
  • 2
    If you've got code that works to 5 decimal places, a good question might be "How do I do this [...] but to 6 or more decimal places?" It might be that its only printing 5 decimal places, but unless you show a code example we can't tell. – Spacedman Jan 23 '24 at 07:26

1 Answers1

0

As Spacedman pointed out, R is just not printing out all the decimal places. I feel silly for not having thought of that given the amount of time I spend in R, but then again, I rarely think 6 decimal places out! Here is Robert's code (linked in original post), but with options for more decimal places:

p1 <- cbind(-90.234036, 37.673442) 
p2 <- cbind(-90.953669, 36.109997 )

library(geosphere) steps <- seq(0, 360, 0.1) c1 <- destPoint(p1, steps, 107.5 * 1852) c2 <- destPoint(p2, steps, 145 * 1852)

library(raster) s1 <- spLines(c1) s2 <- spLines(c2)

i <- intersect(s1, s2) coordinates(i)

x y

-92.38241 38.24267

-88.15830 36.98740

s <- bind(s1, s2) crs(s) <- "+proj=longlat +datum=WGS84" plot(s) points(i, col='red', pch=20, cex=2)

options(digits=20) coordinates(i)

                      x                     y

#[1,] -92.382414938640280866 38.242669773141031442 #[2,] -88.158303526976155240 36.987395741226784196

Aegis
  • 119
  • 5