%% Convert Route to Cartesian Coordinates
% Load a GPS route.

d = load('geoRoute.mat');

% Define the origin in geographic coordinates, latitude and longitude.

alt = 10;  % 10 meters is an approximate altitude in Boston, MA
origin = [d.latitude(1), d.longitude(1), alt];

% Convert the route from geographic coordinates to Cartesian coordinates, x and y.

[xEast,yNorth] = latlon2local(d.latitude,d.longitude,alt,origin);

% Plot the route in Cartesian coordinates.

figure;
plot(xEast,yNorth)
axis('equal'); % set 1:1 aspect ratio to see real-world shape

% Copyright 2019 The MathWorks, Inc.