Index: /trunk/thirds/otb2zcfg/CMakeLists.txt
===================================================================
--- /trunk/thirds/otb2zcfg/CMakeLists.txt	(revision 774)
+++ /trunk/thirds/otb2zcfg/CMakeLists.txt	(revision 775)
@@ -12,3 +12,3 @@
  
 ADD_EXECUTABLE(otb2zcfg otb2zcfg.cxx )  
-TARGET_LINK_LIBRARIES(otb2zcfg OTBCommon OTBApplicationEngine OTBIO ${ITK_LIBRARIES}) 
+TARGET_LINK_LIBRARIES(otb2zcfg OTBCommon OTBApplicationEngine OTBImageIO ${ITK_LIBRARIES}) 
Index: /trunk/zoo-project/zoo-kernel/configure.ac
===================================================================
--- /trunk/zoo-project/zoo-kernel/configure.ac	(revision 774)
+++ /trunk/zoo-project/zoo-kernel/configure.ac	(revision 775)
@@ -334,4 +334,5 @@
 # Check headers file
 CPPFLAGS_SAVE="$CPPFLAGS"
+CGAL_CPPFLAGS="-I$CGALPATH/include"
 CPPFLAGS="$CGAL_CPPFLAGS"
 AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
@@ -725,4 +726,8 @@
         [OTBPATH="$withval"], [OTBPATH=""])
 
+AC_ARG_WITH([otb-version],
+        [AS_HELP_STRING([--with-otb-version=PATH], [Specifies an alternative location for the otb library])],
+        [OTBVERS="$withval"], [OTBVERS=""])
+
 if test -z "$OTBPATH"
 then
@@ -737,6 +742,13 @@
     	fi
 	OTB_ENABLED="-DUSE_OTB"
-	OTB_LDFLAGS="-L$OTBPATH/lib/otb -lOTBIO -lOTBCommon -lOTBApplicationEngine -L$ITKPATH/lib -lITKBiasCorrection-$ITKVERS -lITKCommon-$ITKVERS -lITKIOImageBase-$ITKVERS -lITKKLMRegionGrowing-$ITKVERS -lITKLabelMap-$ITKVERS -lITKMesh-$ITKVERS -lITKMetaIO-$ITKVERS -lITKOptimizers-$ITKVERS -lITKPath-$ITKVERS -lITKPolynomials-$ITKVERS -lITKQuadEdgeMesh-$ITKVERS -lITKSpatialObjects-$ITKVERS -lITKStatistics-$ITKVERS -lITKVNLInstantiation-$ITKVERS -lITKWatersheds-$ITKVERS -litkNetlibSlatec-$ITKVERS -litksys-$ITKVERS -litkdouble-conversion-$ITKVERS -litkv3p_lsqr-$ITKVERS -litkv3p_netlib-$ITKVERS -litkvcl-$ITKVERS -litkvnl-$ITKVERS -litkvnl_algo-$ITKVERS -litkzlib-$ITKVERS"
-	OTB_CPPFLAGS="-I$OTBPATH/include/otb/ApplicationEngine -I$OTBPATH/include/otb/Common -I$ITKPATH/include/ITK-$ITKVERS -I$OTBPATH/include/otb/Utilities/ITK -I$OTBPATH/include/otb/ -I$OTBPATH/include/otb/IO -I$OTBPATH/include/otb/UtilitiesAdapters/OssimAdapters -I$OTBPATH/include/otb/UtilitiesAdapters/CurlAdapters -I$OTBPATH/include/otb/Utilities/BGL -I$OTBPATH/include/otb/UtilitiesAdapters/ITKPendingPatches -I$OTBPATH/include/otb/Utilities/otbconfigfile $GDAL_CFLAGS"
+	if test -a "${OTBPATH}/include/OTB-${OTBVERS}" ; then 
+		OTB_RPATH="$OTBPATH/include/OTB-${OTBVERS}/"
+		OTB_CPPFLAGS="-I${OTB_RPATH}ApplicationEngine -I$OTB_RPATH/Common -I$ITKPATH/include/ITK-$ITKVERS -I$OTB_RPATH/Utilities/ITK -I$OTB_RPATH/ -I$OTB_RPATH/IO -I$OTB_RPATH/UtilitiesAdapters/OssimAdapters -I$OTB_RPATH/UtilitiesAdapters/CurlAdapters -I$OTB_RPATH/Utilities/BGL -I$OTB_RPATH/UtilitiesAdapters/ITKPendingPatches -I$OTB_RPATH/Utilities/otbconfigfile $GDAL_CFLAGS"
+		OTB_LDFLAGS="-L/usr/lib/x86_64-linux-gnu/ -lOTBImageIO-$OTBVERS -lOTBCommon-$OTBVERS -lOTBApplicationEngine-$OTBVERS -L$ITKPATH/lib -lITKBiasCorrection-$ITKVERS -lITKCommon-$ITKVERS -lITKIOImageBase-$ITKVERS -lITKKLMRegionGrowing-$ITKVERS -lITKLabelMap-$ITKVERS -lITKMesh-$ITKVERS -lITKMetaIO-$ITKVERS -lITKOptimizers-$ITKVERS -lITKPath-$ITKVERS -lITKPolynomials-$ITKVERS -lITKQuadEdgeMesh-$ITKVERS -lITKSpatialObjects-$ITKVERS -lITKStatistics-$ITKVERS -lITKVNLInstantiation-$ITKVERS -lITKWatersheds-$ITKVERS -litkNetlibSlatec-$ITKVERS -litksys-$ITKVERS -litkv3p_lsqr-$ITKVERS -litkv3p_netlib-$ITKVERS -litkvcl-$ITKVERS -litkvnl-$ITKVERS -litkvnl_algo-$ITKVERS "
+	else
+		OTB_CPPFLAGS="-I$OTBPATH/include/otb/ApplicationEngine -I$OTBPATH/include/otb/Common -I$ITKPATH/include/ITK-$ITKVERS -I$OTBPATH/include/otb/Utilities/ITK -I$OTBPATH/include/otb/ -I$OTBPATH/include/otb/IO -I$OTBPATH/include/otb/UtilitiesAdapters/OssimAdapters -I$OTBPATH/include/otb/UtilitiesAdapters/CurlAdapters -I$OTBPATH/include/otb/Utilities/BGL -I$OTBPATH/include/otb/UtilitiesAdapters/ITKPendingPatches -I$OTBPATH/include/otb/Utilities/otbconfigfile $GDAL_CFLAGS"
+		OTB_LDFLAGS="-L$OTBPATH/lib/otb -lOTBIO -lOTBCommon -lOTBApplicationEngine -L$ITKPATH/lib -lITKBiasCorrection-$ITKVERS -lITKCommon-$ITKVERS -lITKIOImageBase-$ITKVERS -lITKKLMRegionGrowing-$ITKVERS -lITKLabelMap-$ITKVERS -lITKMesh-$ITKVERS -lITKMetaIO-$ITKVERS -lITKOptimizers-$ITKVERS -lITKPath-$ITKVERS -lITKPolynomials-$ITKVERS -lITKQuadEdgeMesh-$ITKVERS -lITKSpatialObjects-$ITKVERS -lITKStatistics-$ITKVERS -lITKVNLInstantiation-$ITKVERS -lITKWatersheds-$ITKVERS -litkNetlibSlatec-$ITKVERS -litksys-$ITKVERS -litkdouble-conversion-$ITKVERS -litkv3p_lsqr-$ITKVERS -litkv3p_netlib-$ITKVERS -litkvcl-$ITKVERS -litkvnl-$ITKVERS -litkvnl_algo-$ITKVERS -litkzlib-$ITKVERS"
+
+	fi
 	OTB_FILE="otbZooWatcher.o service_internal_otb.o"
 	
@@ -747,13 +759,15 @@
 	LDFLAGS_SAVE="$LDFLAGS"
 	LIBS="$LIBS_SAVE $OTB_LDFLAGS"
-	AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
-			[], [AC_MSG_ERROR([could not find header file $i related to OTB])])
-	AC_LANG_POP([C++])
-	AC_LANG(C++)
+	echo $OTB_CPPFLAGS
+	#AC_CHECK_HEADERS([otbWrapperApplication.h otbWrapperInputImageListParameter.h otbWrapperApplicationRegistry.h],
+	#		[], [AC_MSG_ERROR([could not find header file $i related to OTB])])
 	LDFLAGS_SAVE="$LDFLAGS"
 	LDFLAGS="$OTB_LDFLAGS"
+	echo $OTB_LDFLAGS
 	AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "otbWrapperApplication.h"],[std::vector<std::string> list = otb::Wrapwper::ApplicationRegistry::GetAvailableApplication();]])],
 		[AC_MSG_RESULT([checking for GetAvailableApplication... yes])],[AC_MSG_ERROR([checking for GetAvailableApplication... failed])])
 	LDFLAGS="$LDFLAGS_SAVE"
+	AC_LANG_POP([C++])
+	AC_LANG(C++)
 			
 fi
Index: /trunk/zoo-project/zoo-services/cgal/cgal_service.c
===================================================================
--- /trunk/zoo-project/zoo-services/cgal/cgal_service.c	(revision 774)
+++ /trunk/zoo-project/zoo-services/cgal/cgal_service.c	(revision 775)
@@ -29,8 +29,19 @@
   VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmpm->value,strlen(tmpm->value),FALSE);
   VSIFCloseL(ifile);
+#if GDAL_VERSION_MAJOR >= 2
+  GDALDataset *ipoDS =
+    (GDALDataset*) GDALOpenEx( filename,
+			       GDAL_OF_READONLY | GDAL_OF_VECTOR,
+			       NULL, NULL, NULL );
+#else
   OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE);
+#endif
   if( ipoDS == NULL )
     {
+#if GDAL_VERSION_MAJOR >= 2
+      GDALDriverManager* poR=GetGDALDriverManager();
+#else
       OGRSFDriverRegistrar    *poR = OGRSFDriverRegistrar::GetRegistrar();
+#endif
       
       fprintf( stderr, "FAILURE:\n"
@@ -40,5 +51,9 @@
       for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
         {
-	  fprintf( stderr, "  -> %s\n", poR->GetDriver(iDriver)->GetName() );
+#if GDAL_VERSION_MAJOR >= 2
+	    fprintf( stderr, "  -> %s\n", poR->GetDriver(iDriver)->GetDescription() );
+#else
+	    fprintf( stderr, "  -> %s\n", poR->GetDriver(iDriver)->GetName() );
+#endif
         }
       char tmp[1024];
Index: /trunk/zoo-project/zoo-services/cgal/delaunay.c
===================================================================
--- /trunk/zoo-project/zoo-services/cgal/delaunay.c	(revision 774)
+++ /trunk/zoo-project/zoo-services/cgal/delaunay.c	(revision 775)
@@ -50,10 +50,14 @@
     /*      Try opening the output datasource as an existing, writable      */
     /* -------------------------------------------------------------------- */
-    OGRDataSource       *poODS;
-    
+#if GDAL_VERSION_MAJOR >= 2
+    GDALDataset *poODS;
+    GDALDriverManager* poR=GetGDALDriverManager();
+    GDALDriver          *poDriver = NULL;
+#else
+    OGRDataSource       *poODS;    
     OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();
     OGRSFDriver          *poDriver = NULL;
+#endif
     int                  iDriver;
-
     map *tmpMap=getMapFromMaps(outputs,"Result","mimeType");
     const char *oDriver;
@@ -70,7 +74,18 @@
       {
 #ifdef DEBUG
+#if GDAL_VERSION_MAJOR >= 2
+	fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetDescription());
+#else
 	fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName());
 #endif
-	if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver) )
+#endif
+	if( EQUAL(
+#if GDAL_VERSION_MAJOR >= 2
+		  poR->GetDriver(iDriver)->GetDescription()
+#else
+		  poR->GetDriver(iDriver)->GetName()
+#endif
+		  ,
+		  oDriver) )
 	  {
 	    poDriver = poR->GetDriver(iDriver);
@@ -86,5 +101,9 @@
 	for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
 	  {
+#if GDAL_VERSION_MAJOR >= 2
+	    sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() );
+#else
 	    sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
+#endif
 	  }
 
@@ -94,11 +113,16 @@
       }
 
-    if( !poDriver->TestCapability( ODrCCreateDataSource ) ){
-      char emessage[1024];
-      sprintf( emessage,  "%s driver does not support data source creation.\n",
-	       "json" );
-      setMapInMaps(conf,"lenv","message",emessage);
-      return SERVICE_FAILED;
-    }
+#if GDAL_VERSION_MAJOR >=2
+    if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) )
+#else
+    if( !poDriver->TestCapability( ODrCCreateDataSource ) )
+#endif
+      {
+	char emessage[1024];
+	sprintf( emessage,  "%s driver does not support data source creation.\n",
+		 "json" );
+	setMapInMaps(conf,"lenv","message",emessage);
+	return SERVICE_FAILED;
+      }
 
     /* -------------------------------------------------------------------- */
@@ -108,5 +132,9 @@
     char **papszDSCO=NULL;
     sprintf(pszDestDataSource,"/vsimem/result_%d",getpid());
+#if GDAL_VERSION_MAJOR >=2
+    poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO );
+#else
     poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO );
+#endif
     if( poODS == NULL ){
       char emessage[1024];      
Index: /trunk/zoo-project/zoo-services/cgal/voronoi.c
===================================================================
--- /trunk/zoo-project/zoo-services/cgal/voronoi.c	(revision 774)
+++ /trunk/zoo-project/zoo-services/cgal/voronoi.c	(revision 775)
@@ -67,10 +67,14 @@
     /*      Try opening the output datasource as an existing, writable      */
     /* -------------------------------------------------------------------- */
-    OGRDataSource       *poODS;
-    
+#if GDAL_VERSION_MAJOR >= 2
+    GDALDataset *poODS;
+    GDALDriverManager* poR=GetGDALDriverManager();
+    GDALDriver          *poDriver = NULL;
+#else
+    OGRDataSource       *poODS;    
     OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();
     OGRSFDriver          *poDriver = NULL;
+#endif
     int                  iDriver;
-
     map* tmpMap=getMapFromMaps(outputs,"Result","mimeType");
     const char *oDriver;
@@ -87,7 +91,18 @@
       {
 #ifdef DEBUG
+#if GDAL_VERSION_MAJOR >= 2
+	fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetDescription());
+#else
 	fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName());
 #endif
-	if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver) )
+#endif
+	if( EQUAL(
+#if GDAL_VERSION_MAJOR >= 2
+		  poR->GetDriver(iDriver)->GetDescription()
+#else
+		  poR->GetDriver(iDriver)->GetName()
+#endif
+		  ,
+		  oDriver) )
 	  {
 	    poDriver = poR->GetDriver(iDriver);
@@ -103,5 +118,9 @@
 	for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
 	  {
+#if GDAL_VERSION_MAJOR >= 2
+	    sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() );
+#else
 	    sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
+#endif
 	  }
 
@@ -111,11 +130,16 @@
       }
 
-    if( !poDriver->TestCapability( ODrCCreateDataSource ) ){
-      char emessage[1024];
-      sprintf( emessage,  "%s driver does not support data source creation.\n",
-	       "json" );
-      setMapInMaps(conf,"lenv","message",emessage);
-      return SERVICE_FAILED;
-    }
+#if GDAL_VERSION_MAJOR >=2
+    if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) )
+#else
+    if( !poDriver->TestCapability( ODrCCreateDataSource ) )
+#endif
+      {
+	char emessage[1024];
+	sprintf( emessage,  "%s driver does not support data source creation.\n",
+		 "json" );
+	setMapInMaps(conf,"lenv","message",emessage);
+	return SERVICE_FAILED;
+      }
 
     /* -------------------------------------------------------------------- */
@@ -126,5 +150,9 @@
     char **papszDSCO=NULL;
     sprintf(pszDestDataSource,"/vsimem/result_%d.json",tpath->value,getpid());
+#if GDAL_VERSION_MAJOR >=2
+    poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO );
+#else
     poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO );
+#endif
     if( poODS == NULL ){
       char emessage[1024];      
