From 101fc022ac78eb13e91945f109764bc85403ce82 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Wed, 23 Jun 2010 16:38:54 +0800
Subject: [PATCH] BUG: fix one bug introduced by e52936aea56d

---
 Code/IO/otbGDALImageIO.cxx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Code/IO/otbGDALImageIO.cxx b/Code/IO/otbGDALImageIO.cxx
index deb682f6b0..e46f260269 100644
--- a/Code/IO/otbGDALImageIO.cxx
+++ b/Code/IO/otbGDALImageIO.cxx
@@ -603,12 +603,18 @@ void GDALImageIO::InternalReadImageInformation()
     m_Spacing[0] = VadfGeoTransform[1];
     m_Spacing[1] = VadfGeoTransform[5];
 
-    //In this case, we are in a geographic projection
+    //In this case, we are in a geographic projection if no other cartographic information was already
+    // available
     // FIXME is there any way to know if we are in WGS 84 ???
-    std::string projRef =
+    std::string projRef;
+    itk::ExposeMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, projRef);
+    if (projRef.empty())
+      {
+      projRef =
           "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]";
 
-    itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, projRef);
+      itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, projRef);
+      }
     }
 
   /* -------------------------------------------------------------------- */
-- 
GitLab