# How would i convert latitude and longitude to meters from a point?

204 views (last 30 days)
Viktor on 19 Jul 2012
Answered: Meysam Mahooti on 1 Nov 2019
I have lots of data points (over 50000) of measured positions from a gps antenna where i have the latitude and longitude of every point. What I would like to do is to plot the points relative to a reference points where the scale of the axis are in meters. I would assume that since the area of the points is very small (approx. 10-20 meters) it is possible to assume that the surface is not a part of a sphere but is a flat surface. Please help me on how to plot this.
Preferably I would like the plot to look something like this:
with meters as the scales on the axis. Atm the only thing I have achieved is scatter(ChipLatLong(:,1),ChipLatLong(:,2))
Which is just a plot of the latitude and longitude on a regular graph.
I would be very thankful for any response
Viktor

Meysam Mahooti on 1 Nov 2019
%--------------------------------------------------------------------------
%
% Position: Position vector (r [m]) from geodetic coordinates
% (Longitude [rad], latitude [rad], altitude [m])
%
%
%--------------------------------------------------------------------------
function r = Position(lon, lat, h)
R_equ = 6378.137e3; % Earth's radius [m]; WGS-84
f = 1/298.257223563; % Flattening; WGS-84
e2 = f*(2-f); % Square of eccentricity
CosLat = cos(lat); % (Co)sine of geodetic latitude
SinLat = sin(lat);
% Position vector
N = R_equ/sqrt(1-e2*SinLat*SinLat);
r(1) = (N+h)*CosLat*cos(lon);
r(2) = (N+h)*CosLat*sin(lon);
r(3) = ((1-e2)*N+h)*SinLat;