Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 8710)
+++ /issm/trunk/src/c/Makefile.am	(revision 8711)
@@ -537,5 +537,7 @@
 					./modules/Xy2llx/Xy2llx.cpp\
 					./modules/Ll2xyx/Ll2xyx.h\
-					./modules/Ll2xyx/Ll2xyx.cpp\
+					./modules/Ll2xyx/Ll2xyx.h\
+					./modules/Exp2Kmlx/Exp2Kmlx.cpp\
+					./modules/Exp2Kmlx/Exp2Kmlx.cpp\
 					./modules/InputDuplicatex/InputDuplicatex.h\
 					./modules/InputDuplicatex/InputDuplicatex.cpp\
@@ -1214,4 +1216,6 @@
 					./modules/Ll2xyx/Ll2xyx.h\
 					./modules/Ll2xyx/Ll2xyx.cpp\
+					./modules/Exp2Kmlx/Exp2Kmlx.cpp\
+					./modules/Exp2Kmlx/Exp2Kmlx.cpp\
 					./modules/InputDuplicatex/InputDuplicatex.h\
 					./modules/InputDuplicatex/InputDuplicatex.cpp\
Index: /issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp
===================================================================
--- /issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp	(revision 8711)
+++ /issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp	(revision 8711)
@@ -0,0 +1,179 @@
+/*!\file Exp2Kmlx
+ * \brief exp to kml conversion routines.
+ */
+
+#include "./Exp2Kmlx.h"
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+#include "../../toolkits/toolkits.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+#include "../modules.h"
+
+int Exp2Kmlx(char* filexp,char* filkml,
+			 int holes,
+			 int sgn,double cm,double sp){
+
+	int     i,j,iret=0;
+	int     nprof;
+	int     *pnvert=NULL;
+	double  **pprofx=NULL,**pprofy=NULL;
+	double  *lat=NULL,*lon=NULL;
+
+	char    indent[81]="";
+	KML_File*          kfile =NULL;
+	KML_Document*      kdoc  =NULL;
+	KML_Folder*        kfold =NULL;
+	KML_Placemark*     kplace=NULL;
+	KML_Polygon*       kpoly =NULL;
+	KML_LinearRing*    kring =NULL;
+
+	FILE*   fid=NULL;
+
+	clock_t clock0,clock1;
+	time_t  time0, time1;
+
+	clock0=clock();
+	time0 =time(NULL);
+	_printf_(true,"\nExp2Kmlx Module -- %s",ctime(&time0));
+
+/*  read exp file  */
+
+	if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,filexp))
+		_error_("Error reading exp file.");
+
+/*  construct kml file  */
+
+	kfile =new KML_File();
+	kfile->AddAttrib("xmlns","http://www.opengis.net/kml/2.2");
+
+/*  construct kml document  */
+
+	kdoc  =new KML_Document();
+	sprintf(kdoc->name      ,"Exp2Kmlx Module -- %s",ctime(&time0));
+	kdoc->open      =1;
+
+/*  construct kml folder for polygons  */
+
+	kfold =new KML_Folder();
+	sprintf(kfold->name      ,"Polygons translated from file \"%s\".",filexp);
+	kfold->open      =1;
+
+/*  polygon with multiple holes  */
+
+	if (holes) {
+		i=0;
+		kplace=new KML_Placemark();
+		sprintf(kplace->name      ,"Polygon with Holes");
+		kplace->visibility=true;
+
+		kpoly =new KML_Polygon();
+		kring =new KML_LinearRing();
+
+		lat=(double *) xmalloc(pnvert[i]*sizeof(double));
+		lon=(double *) xmalloc(pnvert[i]*sizeof(double));
+		Xy2llx(lat,lon,pprofx[i],pprofy[i],pnvert[i],sgn,cm,sp);
+
+		kring->ncoord    =pnvert[i];
+		kring->coords    =(double (*)[3]) xmalloc(pnvert[i]*3*sizeof(double));
+		for (j=0; j<pnvert[i]; j++) {
+			kring->coords[j][0]=lon[j];
+			kring->coords[j][1]=lat[j];
+			kring->coords[j][2]=0.;
+		}
+		xfree((void**)&lon);
+		xfree((void**)&lat);
+
+		(kpoly ->outer     )->AddObject((Object*)kring);
+		kring =NULL;
+
+		for (i=1; i<nprof; i++) {
+			kring =new KML_LinearRing();
+
+			lat=(double *) xmalloc(pnvert[i]*sizeof(double));
+			lon=(double *) xmalloc(pnvert[i]*sizeof(double));
+			Xy2llx(lat,lon,pprofx[i],pprofy[i],pnvert[i],sgn,cm,sp);
+			kring->ncoord    =pnvert[i];
+			kring->coords    =(double (*)[3]) xmalloc(pnvert[i]*3*sizeof(double));
+			for (j=0; j<pnvert[i]; j++) {
+				kring->coords[j][0]=lon[j];
+				kring->coords[j][1]=lat[j];
+				kring->coords[j][2]=0.;
+			}
+			xfree((void**)&lon);
+			xfree((void**)&lat);
+
+			(kpoly ->inner     )->AddObject((Object*)kring);
+			kring =NULL;
+		}
+
+		(kplace->geometry  )->AddObject((Object*)kpoly);
+		kpoly =NULL;
+		(kfold ->feature   )->AddObject((Object*)kplace);
+		kplace=NULL;
+	}
+
+/*  multiple polygons  */
+
+	else {
+		for (i=0; i<nprof; i++) {
+			kplace=new KML_Placemark();
+			sprintf(kplace->name      ,"Polygon %d",i);
+			kplace->visibility=true;
+
+			kpoly =new KML_Polygon();
+			kring =new KML_LinearRing();
+
+			lat=(double *) xmalloc(pnvert[i]*sizeof(double));
+			lon=(double *) xmalloc(pnvert[i]*sizeof(double));
+			Xy2llx(lat,lon,pprofx[i],pprofy[i],pnvert[i],sgn,cm,sp);
+
+			kring->ncoord    =pnvert[i];
+			kring->coords    =(double (*)[3]) xmalloc(pnvert[i]*3*sizeof(double));
+			for (j=0; j<pnvert[i]; j++) {
+				kring->coords[j][0]=lon[j];
+				kring->coords[j][1]=lat[j];
+				kring->coords[j][2]=0.;
+			}
+			xfree((void**)&lon);
+			xfree((void**)&lat);
+
+			(kpoly ->outer     )->AddObject((Object*)kring);
+			kring =NULL;
+
+			(kplace->geometry  )->AddObject((Object*)kpoly);
+			kpoly =NULL;
+			(kfold ->feature   )->AddObject((Object*)kplace);
+			kplace=NULL;
+		}
+	}
+
+/*  assemble the rest of the kml hierarchy  */
+
+	(kdoc ->feature   )->AddObject((Object*)kfold);
+	kfold=NULL;
+	(kfile->kmlobj    )->AddObject((Object*)kdoc);
+	kdoc =NULL;
+
+/*  write kml file  */
+
+	_printf_(true,"Writing kml document to file.\n");
+	fid=fopen(filkml,"w");
+	fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+	kfile->Write(fid,indent);
+	fclose(fid);
+
+	delete kfile;
+	for (i=nprof-1; i>=0; i--) {
+		xfree((void**)&(pprofy[i]));
+		xfree((void**)&(pprofx[i]));
+	}
+	xfree((void**)&pnvert);
+
+	clock1=clock();
+	time1 =time(NULL);
+	_printf_(true,"Exp2Kmlx Module -- %f CPU seconds; %f elapsed seconds.\n\n",
+			 ((double)(clock1-clock0))/CLOCKS_PER_SEC,difftime(time1,time0));
+
+	return(iret);
+}
+
Index: /issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.h
===================================================================
--- /issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.h	(revision 8711)
+++ /issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.h	(revision 8711)
@@ -0,0 +1,17 @@
+/*!\file:  Exp2Kmlx.h
+ * \brief header file for exp to kml conversion routines.
+ */ 
+
+#ifndef _EXP2KMLX_H
+#define _EXP2KMLX_H
+
+#include <float.h>    /*  DBL_MAX  */
+#include "../../Container/Container.h"
+#include "../../objects/objects.h"
+
+/* local prototypes: */
+int Exp2Kmlx(char* filexp,char* filkml,
+			 int holes,
+			 int sgn,double cm,double sp);
+
+#endif  /* _EXP2KMLX_H */
Index: /issm/trunk/src/c/modules/modules.h
===================================================================
--- /issm/trunk/src/c/modules/modules.h	(revision 8710)
+++ /issm/trunk/src/c/modules/modules.h	(revision 8711)
@@ -55,4 +55,5 @@
 #include "./Xy2llx/Xy2llx.h"
 #include "./Ll2xyx/Ll2xyx.h"
+#include "./Exp2Kmlx/Exp2Kmlx.h"
 #include "./MassFluxx/MassFluxx.h"
 #include "./MaxAbsVxx/MaxAbsVxx.h"
