This is an SQL problem.
I would like an SQL (Linux PostgreSQL) solution to a GPS problem, and I can't be arsed to do it myself. It's Geometry.
I want to be able to calculate (approximately) where something else is when I know where I am (exactly) given a set of distances and a directions from that object.
I also want to eliminate bad data - data that cannot possibly be correct, given the other data available - sometimes I get the data wrong.
I want to know where the other thing is when I have a set of data that tells me where I am (GPS), and how far, and what direction (mostly) the other thing is.
Given a dataset in a PostgreSQL database of where I am, and how far/what direction the other thing is (maybe 1-20 records) I WANT AN SQL QUERY (or queries) that returns the (rough) calculation of where the other thing is, in decimal (GPS) degrees.
'rough' means a constant - use 1km as a guide, which means that the answer must be within a circle of 1km.
I want to be able to vary the 1km, so make it a variable constant ;)
Data is in decimal GPS co-ordinates, direction is either 1,2 or 3 (120 degrees separation), or 0, meaning I don't know what direction it is.
Distance is in decimal metres.
Location result to be delivered in decimal degrees. (a vector).
My idea was to use multiple toroids in an arc covering 120 (in the right direction) or 360 degrees (any direction), at the right distance from me to the target, overlap them and plot a polygon where they overlap.
The centroid of that polygon would be likely to be the location of the target. Ish.
My maths isn't good enough. I could learn.
PostgreSQL query, or shell script using multiple PostgreSQL queries to produce the answers.
That's Linux that is. The best OS on the planet today.
And PostgreSQL. The best Database money cannot buy.