Index: /issm/trunk/src/m/utils/LatLong/ll2xy.m
===================================================================
--- /issm/trunk/src/m/utils/LatLong/ll2xy.m	(revision 2079)
+++ /issm/trunk/src/m/utils/LatLong/ll2xy.m	(revision 2079)
@@ -0,0 +1,30 @@
+function [x,y]=ll2xy(lat,lon);
+%LL2XY - convert latitude and longitude coordinates to x and y
+%
+%   Usage:
+%      [x,y]=ll2xy(lat,lon)
+%
+%   See also MAPLL, MAPXY
+
+lon=lon+360; % to have 0<lon<360
+
+re = 6378137.0; 	% WGS84
+e2 = 0.00669437999015;  % WGS84
+sn=-1.0; 	% because it's southern hemisphere
+
+a=re;
+e=sqrt(e2);
+
+phi  = sn*lat*pi/180;
+lambda  = lon*pi/180; 
+
+qp = 1 - (1-e2)/2/e*log((1-e)/(1+e));
+%m=cos(phi)/sqrt(1-e2.*sin(phi)*sin(phi));
+q=(1-e2)*(sin(phi)./(1-e2*sin(phi).^2)-0.5/e*log((1-e*sin(phi))./(1+e*sin(phi))));
+rho = a*sqrt(qp-q);
+x = rho.*sin(lambda);
+y = - sn*rho.*cos(lambda);
+
+
+%lon=lon-360; % to recover the initial longitude
+
Index: /issm/trunk/src/m/utils/LatLong/mapll.m
===================================================================
--- /issm/trunk/src/m/utils/LatLong/mapll.m	(revision 2078)
+++ /issm/trunk/src/m/utils/LatLong/mapll.m	(revision 2079)
@@ -1,3 +1,3 @@
-function  [x,y]=mapll(alat,alon,hem);
+function  [x,y]=mapll(lat,lon,hem);
 %MAPLL - convert latitude and longitude into x and y
 %
@@ -10,26 +10,29 @@
 %   See also MAPXY, LL2XY
 
-re=6378137.0; 
+%some corrections
+lon=lon+360;       % to have 0<lon<360
+
+%WGS84
+re=6378137.0;
 e2= 0.00669437999015;
-
 e=sqrt(e2);
 
 %Standard parallel - latitude with no distortion = -71.
-slat=71;
-sn=-1.0;
-xlam=0;
-
 if hem==1,
-   xlam=45;
+	%Northern hemisphere
 	sn=1;
 	slat=70;
+	xlam=45;
+else
+	%Southern Hemisphere
+	sn=-1.0;
+	slat=71;
+	xlam=0;
 end
 
-alat=sn*alat;
-alon=sn*alon;
-alat=alat/180*pi;
-alon=alon/180*pi;
+lat=sn*lat*pi/180;
+lon=lon*pi/180;
 
-rlat=alat;
+rlat=lat;
 slat=slat/180*pi;
 xlam=xlam/180*pi;
@@ -43,4 +46,4 @@
 cm=cos(slat)./sqrt(1.0-e2*(sin(slat).^2));
 rho=re*cm.*t1./t2;
-x= rho*sn.*sin((alon+xlam));
-y=-rho*sn.*cos((alon+xlam));
+x= rho*sn.*sin((lon+xlam));
+y=-rho*sn.*cos((lon+xlam));
