ll2xy

PURPOSE ^

LL2XY - convert latitude and longitude coordinates to x and y

SYNOPSIS ^

function [x,y]=ll2xy(lat,lon);

DESCRIPTION ^

LL2XY - convert latitude and longitude coordinates to x and y

   Usage:
      [x,y]=ll2xy(lat,lon)

   See also MAPLL, MAPXY

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [x,y]=ll2xy(lat,lon);
0002 %LL2XY - convert latitude and longitude coordinates to x and y
0003 %
0004 %   Usage:
0005 %      [x,y]=ll2xy(lat,lon)
0006 %
0007 %   See also MAPLL, MAPXY
0008 
0009 lon=lon+360; % to have 0<lon<360
0010 
0011 re = 6378137.0;     % WGS84
0012 e2 = 0.00669437999015;  % WGS84
0013 sn=-1.0;     % because it's southern hemisphere
0014 
0015 a=re;
0016 e=sqrt(e2);
0017 
0018 phi  = sn*lat*pi/180;
0019 lambda  = lon*pi/180; 
0020 
0021 qp = 1 - (1-e2)/2/e*log((1-e)/(1+e));
0022 %m=cos(phi)/sqrt(1-e2.*sin(phi)*sin(phi));
0023 q=(1-e2)*(sin(phi)./(1-e2*sin(phi).^2)-0.5/e*log((1-e*sin(phi))./(1+e*sin(phi))));
0024 rho = a*sqrt(qp-q);
0025 x = rho.*sin(lambda);
0026 y = - sn*rho.*cos(lambda);
0027 
0028 
0029 %lon=lon-360; % to recover the initial longitude
0030

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003