I have had reason to pursue a similar goal in the past where accuracy is not of huge importance. We can start by getting the Earth's radius according to the WGS84 Well-Known Text definition.
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]
To make sense of the angular distance units, you can use the following formula to convert angular units to meters:
angular_units * (PI/180) * 6378137
That should give you a reasonably accurate short-distance measurements in meters. The calculation is based on a perfect sphere (non-ellipsoidal).
Using the Non Linear Fitting method as provided by whuber in (Trilateration algorithm for n amount of points) I used Matlab to solve the problem.
P = [51.505348978413,-0.11270052661132;
51.4845086249581,-3.16947466601561;
55.9568033803799,-3.20266968478392];
R = [75.639168, 173.809152, 465.100416];
R = R*1000; %convert km to m
opts = statset('MaxIter',1000);
beta0 = [53.374, -1.394];
BETA=nlinfit(P,R,'myfun',beta0,opts)
- P are the 3 trilateration points (lat, lon)
- R are the ranges from my sample point to points in P distance-over-ground
- beta0 are the initial guesses for a position that meets the condition defined by P and R
myfun is in a separate file
function result = myfun(beta, X)
ellipsoid = [6378137, 8.1819190842622e-2];
result(1) = distance(51.505348978413, -0.11270052661132, beta(1), beta(2), ellipsoid);
result(2) = distance(51.4845086249581, -3.16947466601561, beta(1), beta(2), ellipsoid);
result(3) = distance(55.9568033803799, -3.20266968478392, beta(1), beta(2), ellipsoid);
I'm not sure what X does in this case, but myfun needs to have two inputs (beta & X). The initial guess returns three distances to my points P. result is compared to R until a maximum of 1000 iterations (or some error is reduced below a limit - not sure what this limit is or where to set it yet).
Once the values for beta have been found that results in the same values of R the final values are stored in BETA
Best Answer
For a discussion of various problems in ellipsoidal trigonometry, see Sections 10 and 11 of http://arxiv.org/abs/1102.1215
Some similar problems are also discussed in http://dx.doi.org/10.1007/s00190-012-0578-z