Index: ../trunk-jpl/src/m/coordsystems/ll2utm.m
===================================================================
--- ../trunk-jpl/src/m/coordsystems/ll2utm.m	(revision 18477)
+++ ../trunk-jpl/src/m/coordsystems/ll2utm.m	(revision 18478)
@@ -1,13 +1,13 @@
-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.
 %
 %	LAT and LON can be scalars, vectors or matrix. Outputs X and Y will
 %	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
 %		'clk66': Clarke 1866
@@ -17,14 +17,17 @@
 %	or DATUM can be a 2-element vector [A,F] where A is semimajor axis (in
 %	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).
+%	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 
+%
+%	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.
 %
@@ -33,9 +36,12 @@
 %		I.G.N., Projection cartographique Mercator Transverse: Algorithmes,
 %		   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
 
 
 %	Copyright (c) 2001-2014, François Beauducel, covered by BSD License.
@@ -73,27 +79,49 @@
 	{ 'clk66', 6378206.4, 294.978698214 };
 ];
 
-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);
 	end
@@ -101,28 +129,26 @@
 	A1 = datums{k,2};
 	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
+p1 = lat/D0;			% Phi = Latitude (rad)
+l1 = lon/D0;			% Lambda = Longitude (rad)
 
-K0 = 0.9996;	% UTM scale factor
-X0 = 500000;	% UTM false East (m)
+% 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;
 
 C = coef(E1,0);
@@ -197,4 +223,4 @@
 
 for i = 1:size(c0,1)
     c(i) = polyval(c0(i,:),e);
-end
\ No newline at end of file
+end
Index: ../trunk-jpl/src/m/coordsystems/utm2ll.m
===================================================================
--- ../trunk-jpl/src/m/coordsystems/utm2ll.m	(revision 18477)
+++ ../trunk-jpl/src/m/coordsystems/utm2ll.m	(revision 18478)
@@ -1,6 +1,6 @@
 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.
 %
@@ -29,10 +29,11 @@
 %		I.G.N., Projection cartographique Mercator Transverse: Algorithmes,
 %		   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.
 %	All rights reserved.
 %
@@ -104,11 +105,11 @@
 maxiter = 100;	% maximum iteration for latitude computation
 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;
 
@@ -187,4 +188,4 @@
 
 for i = 1:size(c0,1)
     c(i) = polyval(c0(i,:),e);
-end
\ No newline at end of file
+end
