Index: /issm/trunk-jpl/src/m/coordsystems/ll2utm.m
===================================================================
--- /issm/trunk-jpl/src/m/coordsystems/ll2utm.m	(revision 18477)
+++ /issm/trunk-jpl/src/m/coordsystems/ll2utm.m	(revision 18478)
@@ -1,5 +1,5 @@
-function [x,y,f]=ll2utm(lat,lon,datum)
+function [x,y,f]=ll2utm(varargin)
 %LL2UTM Lat/Lon to UTM coordinates precise conversion.
-%   [X,Y]=LL2UTM2(LAT,LON) or LL2UTM([LAT,LON]) converts coordinates 
+%	[X,Y]=LL2UTM2(LAT,LON) or LL2UTM([LAT,LON]) converts coordinates 
 %	LAT,LON (in degrees) to UTM X and Y (in meters). Default datum is WGS84.
 %
@@ -7,6 +7,6 @@
 %	have the same size as inputs.
 %
-%	LL2UTM(LAT,LON,DATUM) uses specific DATUM for conversion. DATUM can be
-%	a string in the following list:
+%	LL2UTM(...,DATUM) uses specific DATUM for conversion. DATUM can be one
+%	of the following char strings:
 %		'wgs84': World Geodetic System 1984 (default)
 %		'nad27': North American Datum 1927
@@ -18,12 +18,15 @@
 %	meters)	and F is flattening of the user-defined ellipsoid.
 %
-%	[X,Y,ZONE]=LL2UTM(...) returns also computed UTM ZONE (negative value 
-%	stands for southern hemisphere points).
-%
-%
-%	XY = LL2UTM(...) or without any output argument returns a 2-column 
+%	LL2UTM(...,ZONE) forces the UTM ZONE (scalar integer) instead of
+%	automatic set.
+%
+%	[X,Y,ZONE]=LL2UTM(...) returns also the computed UTM ZONE (negative
+%	value for southern hemisphere points).
+%
+%
+%	XY=LL2UTM(...) or without any output argument returns a 2-column 
 %	matrix [X,Y].
 %
-%	Notice:
+%	Note:
 %		- LL2UTM does not perform cross-datum conversion.
 %		- precision is near a millimeter.
@@ -34,7 +37,10 @@
 %		   Notes Techniques NT/G 76, janvier 1995.
 %
-%   Author: Francois Beauducel, <beauducel@ipgp.fr>
-%   Created: 2003-12-02
-%   Updated: 2014-04-20
+%	Acknowledgments: Mathieu.
+%
+%
+%	Author: Francois Beauducel, <beauducel@ipgp.fr>
+%	Created: 2003-12-02
+%	Updated: 2014-08-24
 
 
@@ -74,25 +80,47 @@
 ];
 
-if nargin == 1
-	if size(lat,2) ~= 2
-		error('Single input argument must be a 2-column matrix [LAT,LON].')
-	end
-	lon = lat(:,2);
-	lat = lat(:,1);
-end
-	
+% constants
+D0 = 180/pi;	% conversion rad to deg
+K0 = 0.9996;	% UTM scale factor
+X0 = 500000;	% UTM false East (m)
+
+% defaults
+datum = 'wgs84';
+zone = [];
+
 if nargin < 1
 	error('Not enough input arguments.')
 end
 
+if isnumeric(varargin{1}) & size(varargin{1},2) == 2
+	lat = varargin{1}(:,1);
+	lon = varargin{1}(:,2);
+	v = 1;
+elseif nargin > 1 & isnumeric(varargin{2})
+	lat = varargin{1};
+	lon = varargin{2};
+	v = 2;
+else
+	error('Single input argument must be a 2-column matrix [LAT,LON].')
+end
+
 if all([numel(lat),numel(lon)] > 1) && any(size(lat) ~= size(lon))
 	error('LAT and LON must be the same size or scalars.')
 end
 
-if nargin < 3
-	datum = 'wgs84';
+for n = (v+1):nargin
+	% LL2UTM(...,DATUM)
+	if ischar(varargin{n}) | (isnumeric(varargin{n}) & numel(varargin{n})==2)
+		datum = varargin{n};
+	% LL2UTM(...,ZONE)
+	elseif isnumeric(varargin{n}) & isscalar(varargin{n})
+			zone = round(varargin{n});
+	else
+		error('Unknown argument #%d. See documentation.',n)
+	end
 end
 
 if ischar(datum)
+	% LL2UTM(...,DATUM) with DATUM as char
 	if ~any(strcmpi(datum,datums(:,1)))
 		error('Unkown DATUM name "%s"',datum);
@@ -102,26 +130,24 @@
 	F1 = datums{k,3};	
 else
-	if numel(datum) ~= 2
-		error('User defined DATUM must be a vector [A,F].');
-	end
+	% LL2UTM(...,DATUM) with DATUM as [A,F] user-defined
 	A1 = datum(1);
 	F1 = datum(2);
 end
 
-% constants
-D0 = 180/pi;	% conversion rad to deg
-
-K0 = 0.9996;	% UTM scale factor
-X0 = 500000;	% UTM false East (m)
+p1 = lat/D0;			% Phi = Latitude (rad)
+l1 = lon/D0;			% Lambda = Longitude (rad)
+
+% UTM zone automatic setting
+if isempty(zone)
+	F0 = round((l1*D0 + 183)/6);
+else
+	F0 = zone;
+end
 
 B1 = A1*(1 - 1/F1);
 E1 = sqrt((A1*A1 - B1*B1)/(A1*A1));
-
-p1 = lat/D0;					% Phi = Latitude (rad)
-l1 = lon/D0;					% Lambda = Longitude (rad)
-F0 = round((l1*D0 + 183)/6);	% UTM zone
 P0 = 0/D0;
-L0 = (6*F0 - 183)/D0;			% UTM origin longitude (rad)
-Y0 = 1e7*(p1 < 0);				% UTM false northern (m)
+L0 = (6*F0 - 183)/D0;		% UTM origin longitude (rad)
+Y0 = 1e7*(p1 < 0);		% UTM false northern (m)
 N = K0*A1;
 
Index: /issm/trunk-jpl/src/m/coordsystems/utm2ll.m
===================================================================
--- /issm/trunk-jpl/src/m/coordsystems/utm2ll.m	(revision 18477)
+++ /issm/trunk-jpl/src/m/coordsystems/utm2ll.m	(revision 18478)
@@ -1,5 +1,5 @@
 function [lat,lon]=utm2ll(x,y,f,datum,varargin)
 %UTM2LL UTM to Lat/Lon coordinates precise conversion.
-%   [LAT,LON]=UTM2LL(X,Y,ZONE) converts UTM coordinates X,Y (in meters)
+%	[LAT,LON]=UTM2LL(X,Y,ZONE) converts UTM coordinates X,Y (in meters)
 %	defined in the UTM ZONE (integer) to latitude LAT and longitude LON 
 %	(in degrees). Default datum is WGS84.
@@ -30,7 +30,8 @@
 %		   Notes Techniques NT/G 76, janvier 1995.
 %
-%   Author: Francois Beauducel, <beauducel@ipgp.fr>
-%   Created: 2001-08-23
-%   Updated: 2014-04-20
+%	Author: Francois Beauducel, <beauducel@ipgp.fr>
+%	Created: 2001-08-23
+%	Updated: 2014-04-20
+
 
 %	Copyright (c) 2001-2014, François Beauducel, covered by BSD License.
@@ -105,9 +106,9 @@
 eps = 1e-11;	% minimum residue for latitude computation
 
-K0 = 0.9996;								% UTM scale factor
-X0 = 500000;								% UTM false East (m)
-Y0 = 1e7*(f < 0);							% UTM false North (m)
-P0 = 0;										% UTM origin latitude (rad)
-L0 = (6*abs(f) - 183)/D0;					% UTM origin longitude (rad)
+K0 = 0.9996;					% UTM scale factor
+X0 = 500000;					% UTM false East (m)
+Y0 = 1e7*(f < 0);				% UTM false North (m)
+P0 = 0;						% UTM origin latitude (rad)
+L0 = (6*abs(f) - 183)/D0;			% UTM origin longitude (rad)
 E1 = sqrt((A1^2 - (A1*(1 - 1/F1))^2)/A1^2);	% ellpsoid excentricity
 N = K0*A1;
