Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 15068)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 15069)
@@ -181,4 +181,6 @@
 					./shared/io/Comm/IssmComm.h\
 					./shared/io/Comm/IssmComm.cpp\
+					./shared/LatLong/Ll2xyx.cpp\
+					./shared/LatLong/Xy2llx.cpp\
 					./shared/Enum/Enum.h\
 					./shared/Enum/EnumDefinitions.h\
@@ -802,8 +804,4 @@
 			./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp\
 			./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp\
-			./modules/Xy2llx/Xy2llx.h\
-			./modules/Xy2llx/Xy2llx.cpp\
-			./modules/Ll2xyx/Ll2xyx.h\
-			./modules/Ll2xyx/Ll2xyx.cpp\
 			./modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp\
 			./modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h\
Index: /issm/trunk-jpl/src/c/kml/KMLFileReadUtils.cpp
===================================================================
--- /issm/trunk-jpl/src/c/kml/KMLFileReadUtils.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/kml/KMLFileReadUtils.cpp	(revision 15069)
@@ -11,5 +11,6 @@
 #endif
 
-#include "../kml/kmlobjects.h"
+#include "./KMLFileReadUtils.h"
+#include "./KML_Object.h"
 #include "../shared/shared.h"
 /*}}}*/
Index: /issm/trunk-jpl/src/c/kml/KML_LineString.cpp
===================================================================
--- /issm/trunk-jpl/src/c/kml/KML_LineString.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/kml/KML_LineString.cpp	(revision 15069)
@@ -14,5 +14,4 @@
 #include "./KMLFileReadUtils.h"
 #include "../shared/shared.h"
-#include "../modules/Ll2xyx/Ll2xyx.h"
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/kml/KML_LinearRing.cpp
===================================================================
--- /issm/trunk-jpl/src/c/kml/KML_LinearRing.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/kml/KML_LinearRing.cpp	(revision 15069)
@@ -14,5 +14,4 @@
 #include "./KMLFileReadUtils.h"
 #include "../shared/shared.h"
-#include "../modules/Ll2xyx/Ll2xyx.h"
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/kml/KML_Point.cpp
===================================================================
--- /issm/trunk-jpl/src/c/kml/KML_Point.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/kml/KML_Point.cpp	(revision 15069)
@@ -14,5 +14,4 @@
 #include "./KMLFileReadUtils.h"
 #include "../shared/shared.h"
-#include "../modules/Ll2xyx/Ll2xyx.h"
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp	(revision 15069)
@@ -7,5 +7,4 @@
 #include "../../kml/kmlobjects.h"
 #include "../../toolkits/toolkits.h"
-#include "../Xy2llx/Xy2llx.h"
 
 int Exp2Kmlx(char* filexp,char* filkml,int sgn,bool holes){
Index: /issm/trunk-jpl/src/c/modules/Kml2Expx/Kml2Expx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Kml2Expx/Kml2Expx.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/modules/Kml2Expx/Kml2Expx.cpp	(revision 15069)
@@ -6,5 +6,4 @@
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
-#include "../Ll2xyx/Ll2xyx.h"
 #include "../KMLFileReadx/KMLFileReadx.h"
 
Index: /issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.cpp	(revision 15069)
@@ -4,6 +4,4 @@
 
 #include "./Shp2Expx.h"
-#include "../Ll2xyx/Ll2xyx.h"
-#include "../Xy2llx/Xy2llx.h"
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
Index: /issm/trunk-jpl/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp	(revision 15068)
+++ /issm/trunk-jpl/src/c/modules/Shp2Kmlx/Shp2Kmlx.cpp	(revision 15069)
@@ -4,5 +4,4 @@
 
 #include "./Shp2Kmlx.h"
-#include "../Xy2llx/Xy2llx.h"
 #include "../../shared/shared.h"
 #include "../../toolkits/toolkits.h"
Index: /issm/trunk-jpl/src/c/modules/modules.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/modules.h	(revision 15068)
+++ /issm/trunk-jpl/src/c/modules/modules.h	(revision 15069)
@@ -55,6 +55,4 @@
 #include "./KMLMeshWritex/KMLMeshWritex.h"
 #include "./KMLOverlayx/KMLOverlayx.h"
-#include "./Xy2llx/Xy2llx.h"
-#include "./Ll2xyx/Ll2xyx.h"
 #include "./Exp2Kmlx/Exp2Kmlx.h"
 #include "./Kml2Expx/Kml2Expx.h"
Index: /issm/trunk-jpl/src/c/shared/LatLong/Ll2xyx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/LatLong/Ll2xyx.cpp	(revision 15069)
+++ /issm/trunk-jpl/src/c/shared/LatLong/Ll2xyx.cpp	(revision 15069)
@@ -0,0 +1,126 @@
+/*!\file Ll2xyx.cpp
+ */
+
+#include "../../shared/shared.h"
+#include "./latlong.h"
+#include <math.h>
+
+int Ll2xyx(double* x, double* y, double* lat, double* lon, int ncoord, int sgn){
+/*  This is a cpp conversion of the following:
+%LL2XY - converts lat long to polar stereographic
+%
+%   Converts from geodetic latitude and longitude to Polar 
+%   Stereographic (X,Y) coordinates for the polar regions.
+%   Author: Michael P. Schodlok, December 2003 (map2ll)
+%
+%   Usage:
+%      [x,y] = ll2xy(lat,lon,sgn)
+%      [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)
+%
+%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
+%                               -1 : south latitude (default is mer=0  lat=71)
+*/
+	double  central_meridian,standard_parallel;
+
+	Ll2xydef(&central_meridian,&standard_parallel,sgn);
+
+	return(Ll2xyx(x,y,lat,lon,ncoord,sgn,central_meridian,standard_parallel));
+}
+
+int Ll2xyx(double* x, double* y, double* lat, double* lon, int ncoord, int sgn, double central_meridian, double standard_parallel){
+/*  This is a cpp conversion of the following:
+%LL2XY - converts lat long to polar stereographic
+%
+%   Converts from geodetic latitude and longitude to Polar 
+%   Stereographic (X,Y) coordinates for the polar regions.
+%   Author: Michael P. Schodlok, December 2003 (map2ll)
+%
+%   Usage:
+%      [x,y] = ll2xy(lat,lon,sgn)
+%      [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)
+%
+%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
+%                               -1 : south latitude (default is mer=0  lat=71)
+*/
+
+	int     i,iret=0;
+	double  delta,slat;
+	double  cde,re,ex2,ex;
+	double  latitude,longitude;
+	double  T,rho,sl,tc,mc;
+
+	if((sgn!=1) && (sgn!=-1)) _error_("Sign should be either +1 or -1.\n");
+
+	delta = central_meridian;
+	slat  = standard_parallel;
+
+	/*  Conversion constant from degrees to radians  */
+	cde = 57.29577951;
+	/*  Radius of the earth in meters  */
+	re  = 6378.273*pow(10.,3.);
+	/*  Eccentricity of the Hughes ellipsoid squared  */
+	ex2 = 0.006693883;
+	/*  Eccentricity of the Hughes ellipsoid  */
+	ex  =  sqrt(ex2);
+
+	/*  loop over all the coordinate pairs  */
+	for(i=0; i<ncoord; i++){
+		latitude  = fabs(lat[i]) * PI/180.;
+		longitude = (lon[i] + delta) * PI/180.;
+
+		/*  compute X and Y in grid coordinates.  */
+		T = tan(PI/4.-latitude/2.) / pow(((1.-ex*sin(latitude))/(1.+ex*sin(latitude))),(ex/2.));
+
+		if ((90. - slat) < 1.e-5)
+			rho = 2.*re*T/sqrt(pow((1.+ex),(1.+ex))*pow((1.-ex),(1.-ex)));
+		else {
+			sl  = slat*PI/180.;
+			tc  = tan(PI/4.-sl/2.)/pow(((1.-ex*sin(sl))/(1.+ex*sin(sl))),(ex/2.));
+			mc  = cos(sl)/sqrt(1.0-ex2*(pow(sin(sl),2.)));
+			rho = re*mc*T/tc;
+		}
+
+		y[i]= -rho*(double)sgn*cos(sgn*longitude);
+		x[i]=  rho*(double)sgn*sin(sgn*longitude);
+
+		if (latitude>= PI/2.){
+			x[i] = 0.0;
+			y[i] = 0.0;
+			iret=1;
+		}
+	}
+	return(iret);
+}
+
+void Ll2xydef(double* pdelta, double* pslat, int sgn){
+/*  This is a cpp conversion of the following:
+%LL2XY - converts lat long to polar stereographic
+%
+%   Converts from geodetic latitude and longitude to Polar 
+%   Stereographic (X,Y) coordinates for the polar regions.
+%   Author: Michael P. Schodlok, December 2003 (map2ll)
+%
+%   Usage:
+%      [x,y] = ll2xy(lat,lon,sgn)
+%      [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)
+%
+%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
+%                               -1 : south latitude (default is mer=0  lat=71)
+*/
+	bool    flag=true;
+
+	/*  Get central_meridian and standard_parallel depending on hemisphere  */
+	if (sgn ==  1) {
+		*pdelta= 45;
+		*pslat = 70;
+		if(flag) _pprintLine_("Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).");
+	}
+	else if (sgn == -1) {
+		*pdelta= 0;
+		*pslat = 71;
+		if(flag) _pprintLine_("Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).");
+	}
+	else _error_("Sign should be either +1 or -1.\n");
+
+	return;
+}
Index: /issm/trunk-jpl/src/c/shared/LatLong/Xy2llx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/LatLong/Xy2llx.cpp	(revision 15069)
+++ /issm/trunk-jpl/src/c/shared/LatLong/Xy2llx.cpp	(revision 15069)
@@ -0,0 +1,134 @@
+/*!\file Xy2llx.cpp
+ */
+
+#include "../../shared/shared.h"
+#include "./latlong.h"
+#include <math.h>
+
+int Xy2llx(double* lat, double* lon, double* x, double* y, int ncoord, int sgn){
+/*  This is a cpp conversion of the following:
+%XY2LL - converts xy to lat long
+%
+%   Converts Polar  Stereographic (X,Y) coordinates for the polar regions to
+%   latitude and longitude Stereographic (X,Y) coordinates for the polar
+%   regions.
+%   Author: Michael P. Schodlok, December 2003 (map2xy.m)
+%
+%   Usage:
+%      [lat,lon] = xy2ll(x,y,sgn);
+%      [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel);
+%
+%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
+%                               -1 : south latitude (default is mer=0  lat=71)
+*/
+	double  central_meridian,standard_parallel;
+
+	Xy2lldef(&central_meridian,&standard_parallel,sgn);
+
+	return(Xy2llx(lat,lon,x,y,ncoord,sgn,central_meridian,standard_parallel));
+}
+
+int Xy2llx(double* lat, double* lon, double* x, double* y, int ncoord, int sgn, double central_meridian, double standard_parallel){
+/*  This is a cpp conversion of the following:
+%XY2LL - converts xy to lat long
+%
+%   Converts Polar  Stereographic (X,Y) coordinates for the polar regions to
+%   latitude and longitude Stereographic (X,Y) coordinates for the polar
+%   regions.
+%   Author: Michael P. Schodlok, December 2003 (map2xy.m)
+%
+%   Usage:
+%      [lat,lon] = xy2ll(x,y,sgn);
+%      [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel);
+%
+%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
+%                               -1 : south latitude (default is mer=0  lat=71)
+*/
+
+	int     i,iret=0;
+	double  delta,slat;
+	double  cde,re,ex2,ex;
+	double  sl,rho,cm,T,chi;
+
+	if((sgn!=1) && (sgn!=-1)) _error_("Sign should be either +1 or -1.\n");
+
+	delta = central_meridian;
+	slat  = standard_parallel;
+
+	/*  Conversion constant from degrees to radians  */
+	cde  = 57.29577951;
+	/*  Radius of the earth in meters  */
+	re   = 6378.273*pow(10.,3.);
+	/*  Eccentricity of the Hughes ellipsoid squared  */
+	ex2  = 0.006693883;
+	/*  Eccentricity of the Hughes ellipsoid  */
+	ex   =  sqrt(ex2);
+
+	/*  loop over all the coordinate pairs  */
+	for(i=0; i<ncoord; i++){
+		sl = slat*PI/180.;
+		cm = cos(sl)/sqrt(1.0-ex2*(pow(sin(sl),2.)));
+		rho= sqrt(pow(x[i],2.) + pow(y[i],2.));
+		T  = tan((PI/4.0) - (sl/2.0))/pow(((1.0-ex*sin(sl))/(1.0+ex*sin(sl))),(ex/2.0));
+
+		if(fabs(slat-90.) < 1.e-5)
+			T =rho*sqrt(pow((1.+ex),(1.+ex))*pow((1.-ex),(1.-ex)))/2./re;
+		else
+			T =rho*T/(re*cm);
+
+		chi = (PI / 2.0) - 2.0 * atan(T);
+		lat[i] = chi + ((ex2 / 2.0) + (5.0 * pow(ex2,2.0) / 24.0) + (pow(ex2,3.0) / 12.0)) *
+			   sin(2.0 * chi) + ((7.0 * pow(ex2,2.0) / 48.0) + (29.0 * pow(ex2,3.0) / 240.0)) *
+			   sin(4.0 * chi) + (7.0 * pow(ex2,3.0) / 120.0) * sin(6.0 * chi) ;
+
+		lat[i] = (double)sgn * lat[i];
+		lon[i] = atan2((double)sgn * x[i],-(double)sgn * y[i]);
+		lon[i] = (double)sgn * lon[i];
+
+		if(rho <= 0.1){
+			lat[i] = 90. * (double)sgn;
+			lon[i] = 0.0;
+			iret=1;
+		}
+
+		lon[i] = lon[i] * 180. / PI;
+		lat[i] = lat[i] * 180. / PI;
+		lon[i] = lon[i] - delta; 
+	}
+
+	return(iret);
+}
+
+void Xy2lldef(double* pdelta, double* pslat, int sgn){
+/*  This is a cpp conversion of the following:
+%XY2LL - converts xy to lat long
+%
+%   Converts Polar  Stereographic (X,Y) coordinates for the polar regions to
+%   latitude and longitude Stereographic (X,Y) coordinates for the polar
+%   regions.
+%   Author: Michael P. Schodlok, December 2003 (map2xy.m)
+%
+%   Usage:
+%      [lat,lon] = xy2ll(x,y,sgn);
+%      [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel);
+%
+%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
+%                               -1 : south latitude (default is mer=0  lat=71)
+*/
+	bool    flag=true;
+
+	/*  Get central_meridian and standard_parallel depending on hemisphere  */
+	if (sgn == 1) {
+		*pdelta= 45;
+		*pslat = 70;
+		if(flag) _pprintLine_("Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).");
+	}
+	else if (sgn == -1) {
+		*pdelta= 0;
+		*pslat = 71;
+		if(flag) _pprintLine_("Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).");
+	}
+	else _error_("Sign should be either +1 or -1.\n");
+
+	return;
+}
Index: /issm/trunk-jpl/src/c/shared/LatLong/latlong.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/LatLong/latlong.h	(revision 15069)
+++ /issm/trunk-jpl/src/c/shared/LatLong/latlong.h	(revision 15069)
@@ -0,0 +1,16 @@
+/*!\file: latlong.h
+ * \brief prototypes for latlong.h
+ */ 
+
+#ifndef _SHARED_LATLONG_H_
+#define _SHARED_LATLONG_H_
+
+int Ll2xyx(double* x, double* y, double* lat, double* lon, int ncoord, int sgn);
+int Ll2xyx(double* x, double* y, double* lat, double* lon, int ncoord, int sgn, double central_meridian, double standard_parallel);
+void Ll2xydef(double* pdelta, double* pslat, int sgn);
+
+int Xy2llx(double* lat, double* lon, double* x, double* y, int ncoord, int sgn);
+int Xy2llx(double* lat, double* lon, double* x, double* y, int ncoord, int sgn, double central_meridian, double standard_parallel);
+void Xy2lldef(double* pdelta, double* pslat, int sgn);
+
+#endif //ifndef _SHARED_LATLONG_H_
Index: /issm/trunk-jpl/src/c/shared/shared.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/shared.h	(revision 15068)
+++ /issm/trunk-jpl/src/c/shared/shared.h	(revision 15069)
@@ -19,4 +19,5 @@
 #include "./Threads/issm_threads.h"
 #include "./TriMesh/trimesh.h"
+#include "./LatLong/latlong.h"
 
 #endif
