Index: Providers/GDAL/Src/Provider/FdoRfpClassData.cpp
===================================================================
--- Providers/GDAL/Src/Provider/FdoRfpClassData.cpp	(revision 6064)
+++ Providers/GDAL/Src/Provider/FdoRfpClassData.cpp	(working copy)
@@ -33,6 +33,7 @@
 #include "FdoRfpConnection.h"
 #include "FdoCommonMiscUtil.h"
 #include "FdoRfpDatasetCache.h"
+#include "FdoRfpGlobals.h"
 #include <GdalFile/Override/FdoGrfpOverrides.h>
 #include <gdal.h>
 
@@ -103,10 +104,28 @@
     // Retrieve the spatial context association from the Raster Property
     FdoStringP m_coord = propraster->GetSpatialContextAssociation();
 
+    bool bResetExtents = false;
     if (m_coord == L"") {
         if (coordSystems->GetCount() == 0) {
-            FdoPtr<FdoRfpSpatialContext> defaultContext = 
-                conn->GetDefaultSpatialContext();
+            FdoPtr<FdoRfpSpatialContext> defaultContext = conn->GetDefaultSpatialContext();
+            FdoPtr<FdoByteArray> extentArr = defaultContext->GetExtent();
+            FdoRfpRect ext = FdoRfpUtil::CreateRectFromGeometryAgf(extentArr);
+
+            //HACK: Check if these extents are the default flubbed ones because if we get an actual extent
+            //it will probably be way smaller than the system default. Hence the cause of trac ticket #740
+            //
+            //This check should be enough to out a spatial context as the system default one.
+            if (ext.m_maxX == FdoGrfpGlobals::DefaultSpatialContextExtentMaxX &&
+                ext.m_maxY == FdoGrfpGlobals::DefaultSpatialContextExtentMaxY &&
+                ext.m_minX == FdoGrfpGlobals::DefaultSpatialContextExtentMinX &&
+                ext.m_minY == FdoGrfpGlobals::DefaultSpatialContextExtentMinY &&
+                wcscmp(FdoGrfpGlobals::DefaultSpatialContextName, defaultContext->GetName()) == 0 && 
+                wcscmp(FdoGrfpGlobals::DefaultSpatialContextName, defaultContext->GetCoordinateSystem()) == 0 &&
+                wcscmp(NlsMsgGet(GRFP_67_DEFAULT_SPATIAL_CONTEXT_DESC, "System generated default FDO Spatial Context"), defaultContext->GetDescription()) == 0)
+            {
+                bResetExtents = true;
+            }
+
             m_coord = defaultContext->GetName();
         }
         else if (coordSystems->GetCount() > 1) { 
@@ -131,8 +150,14 @@
     try {
         FdoPtr<FdoByteArray> extentArr = context->GetExtent();
         FdoRfpRect extent = FdoRfpUtil::CreateRectFromGeometryAgf(extentArr);
-        extent = extent.Union(m_extent);
 
+        //Depending on whether we detected a system generated default extent, replace or expand the current extent
+        //with our computed result.
+        if (bResetExtents) 
+            extent = m_extent;
+        else
+            extent = extent.Union(m_extent);
+
         // Set the new extent
         context->SetExtent(FdoRfpUtil::CreateGeometryAgfFromRect(extent));
     }
Index: Providers/GDAL/Src/UnitTest/RfpNoConfigTest2.cpp
===================================================================
--- Providers/GDAL/Src/UnitTest/RfpNoConfigTest2.cpp	(revision 0)
+++ Providers/GDAL/Src/UnitTest/RfpNoConfigTest2.cpp	(revision 0)
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2004-2006  Autodesk, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser
+ * General Public License as published by the Free Software Foundation.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include "UnitTest.h"
+#include "RfpNoConfigTest2.h"
+#include <cmath>
+
+RfpNoConfigTest2::RfpNoConfigTest2(void)
+{
+}
+
+RfpNoConfigTest2::~RfpNoConfigTest2(void)
+{
+}
+
+void RfpNoConfigTest2::_setUp()
+{
+	
+}
+
+void RfpNoConfigTest2::_tearDown()
+{
+
+}
+
+void RfpNoConfigTest2::testSpatialContext()
+{
+    //We want to check spatial context extents from rasters w/o coordinate system info match extents returned by the gdalinfo utility
+
+    //TestData/GeoTiff/AspectTest3
+    FdoPtr<FdoIConnection> connTif = CreateConnection();
+    FDO_CPPUNIT_ASSERT(connTif != NULL);
+
+    connTif->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/GeoTiff/AspectTest3/AspectTest3.tif");
+    connTif->Open();
+
+    FdoPtr<FdoIGetSpatialContexts> getSC = static_cast<FdoIGetSpatialContexts*>(connTif->CreateCommand(FdoCommandType_GetSpatialContexts));
+    getSC->SetActiveOnly(false);
+    FdoPtr<FdoISpatialContextReader> reader = getSC->Execute();
+    FDO_CPPUNIT_ASSERT(reader->ReadNext() == true);
+
+    FdoByteArray* fgf = reader->GetExtent();
+	FdoRfpRect rect = FdoRfpUtil::CreateRectFromGeometryAgf(fgf);
+	
+    printf("LL: %12.7f, %12.7f\n", rect.m_minX, rect.m_minY);
+    printf("UR: %12.7f, %12.7f\n", rect.m_maxX, rect.m_maxY);
+
+    //As reported by gdalinfo
+	FDO_CPPUNIT_ASSERT (rect.m_minX == 9.5);
+	FDO_CPPUNIT_ASSERT (rect.m_minY == -989.5);
+    FDO_CPPUNIT_ASSERT (rect.m_maxX == 1009.5);
+    FDO_CPPUNIT_ASSERT (rect.m_maxY == 10.5);
+
+    connTif->Close();
+
+    //TestData/PNG/CM13ct
+    FdoPtr<FdoIConnection> connPng = CreateConnection();
+    FDO_CPPUNIT_ASSERT(connPng != NULL);
+
+    connPng->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/PNG/CM13ct.png");
+    connPng->Open();
+
+    getSC = static_cast<FdoIGetSpatialContexts*>(connPng->CreateCommand(FdoCommandType_GetSpatialContexts));
+    getSC->SetActiveOnly(false);
+    reader = getSC->Execute();
+    FDO_CPPUNIT_ASSERT(reader->ReadNext() == true);
+
+    fgf = reader->GetExtent();
+	rect = FdoRfpUtil::CreateRectFromGeometryAgf(fgf);
+	
+    printf("LL: %12.7f, %12.7f\n", rect.m_minX, rect.m_minY);
+    printf("UR: %12.7f, %12.7f\n", rect.m_maxX, rect.m_maxY);
+
+    //As reported by gdalinfo, but gdalinfo only displays to 3 decimal places, so compare our numbers to 3 decimal places
+    FDO_CPPUNIT_ASSERT (std::fabs(rect.m_minX - 674425.295) <= 0.001);
+	FDO_CPPUNIT_ASSERT (std::fabs(rect.m_minY - 6431368.631) <= 0.001);
+    FDO_CPPUNIT_ASSERT (std::fabs(rect.m_maxX - 693935.295) <= 0.001);
+    FDO_CPPUNIT_ASSERT (std::fabs(rect.m_maxY - 6462458.631) <= 0.001);
+
+    connPng->Close();
+
+    //TestData/JPG/NBenguela.2004357.aqua.250m  (.!,@#$%^()_+=-`~[]').jpg
+    FdoPtr<FdoIConnection> connJpg = CreateConnection();
+    FDO_CPPUNIT_ASSERT(connJpg != NULL);
+
+    connJpg->SetConnectionString(L"DefaultRasterFileLocation=../../TestData/JPG/NBenguela.2004357.aqua.250m  (.!,@#$%^()_+=-`~[]').jpg");
+    connJpg->Open();
+
+    getSC = static_cast<FdoIGetSpatialContexts*>(connJpg->CreateCommand(FdoCommandType_GetSpatialContexts));
+    getSC->SetActiveOnly(false);
+    reader = getSC->Execute();
+    FDO_CPPUNIT_ASSERT(reader->ReadNext() == true);
+
+    fgf = reader->GetExtent();
+	rect = FdoRfpUtil::CreateRectFromGeometryAgf(fgf);
+	
+    printf("LL: %12.7f, %12.7f\n", rect.m_minX, rect.m_minY);
+    printf("UR: %12.7f, %12.7f\n", rect.m_maxX, rect.m_maxY);
+
+    //As reported by gdalinfo, but gdalinfo only displays to 7 decimal places, so compare our numbers to 7 decimal places
+    FDO_CPPUNIT_ASSERT (std::fabs(rect.m_minX - 8.0045000) <= 0.0000001);
+	FDO_CPPUNIT_ASSERT (std::fabs(rect.m_minY - (-29.0716280)) <= 0.0000001);
+    FDO_CPPUNIT_ASSERT (std::fabs(rect.m_maxX - 16.9977059) <= 0.0000001);
+    FDO_CPPUNIT_ASSERT (std::fabs(rect.m_maxY - (-16.9308000)) <= 0.0000001);
+
+    connJpg->Close();
+
+    //There's probably others, but this is a sufficient sample set for now
+}
\ No newline at end of file
Index: Providers/GDAL/Src/UnitTest/RfpNoConfigTest2.h
===================================================================
--- Providers/GDAL/Src/UnitTest/RfpNoConfigTest2.h	(revision 0)
+++ Providers/GDAL/Src/UnitTest/RfpNoConfigTest2.h	(revision 0)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2006  Autodesk, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser
+ * General Public License as published by the Free Software Foundation.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef RFPNOCONFIGTEST2_H
+#define RFPNOCONFIGTEST2_H
+
+#ifdef _WIN32
+#pragma once
+#endif //_WIN32 
+
+class RfpNoConfigTest2 : public RfpTestCase
+{
+	FDO_CPPUNIT_DEFINE(testSpatialContext);
+
+	CPPUNIT_TEST_SUITE(RfpNoConfigTest2);
+	CPPUNIT_TEST(testSpatialContext);
+	CPPUNIT_TEST_SUITE_END();
+
+public:
+	RfpNoConfigTest2(void);
+	~RfpNoConfigTest2(void);
+
+public:
+	void _setUp();
+	void _tearDown();
+
+//test cases
+public:
+	void testSpatialContext();
+};
+#endif
Index: Providers/GDAL/Src/UnitTest/UnitTest.cpp
===================================================================
--- Providers/GDAL/Src/UnitTest/UnitTest.cpp	(revision 6064)
+++ Providers/GDAL/Src/UnitTest/UnitTest.cpp	(working copy)
@@ -24,6 +24,7 @@
 #include <malloc.h>
 
 #include "RfpNoConfigTest.h"
+#include "RfpNoConfigTest2.h"
 #include "RfpTestExample1.h"
 #include "RfpOverridesSerializeTest.h"
 #ifndef CPPUNIT_MODERN_API
@@ -52,6 +53,7 @@
 // which Test Cases will be excuted.
 
 #define TEST_NO_CONFIG
+#define TEST_NO_CONFIG_2
 #define TEST_EXAMPLE1
 #define TEST_OVERRIDES_SERIALIZE
 #define TEST_THOROUGHTEST
@@ -95,6 +97,10 @@
 	runner.addTest(RfpNoConfigTest::suite());
 #endif
 
+#ifdef TEST_NO_CONFIG_2
+	runner.addTest(RfpNoConfigTest2::suite());
+#endif
+
 #ifdef TEST_EXAMPLE1
 	runner.addTest(RfpTestExample1::suite());
 #endif
Index: Providers/GDAL/Src/UnitTest/UnitTest.vcproj
===================================================================
--- Providers/GDAL/Src/UnitTest/UnitTest.vcproj	(revision 6064)
+++ Providers/GDAL/Src/UnitTest/UnitTest.vcproj	(working copy)
@@ -245,7 +245,7 @@
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\Lib\Win32\Release;&quot;$(FDO)\Unmanaged\Lib\Win32\Release&quot;;&quot;$(FDOUTILITIES)\Common\Lib\Win32\Release&quot;;&quot;$(FDOTHIRDPARTY)\cppunit\lib\Win32&quot;"
 				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="false"
+				GenerateDebugInformation="true"
 				SubSystem="1"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
@@ -376,6 +376,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\RfpNoConfigTest2.cpp"
+				>
+			</File>
+			<File
 				RelativePath="RfpOverridesSerializeTest.cpp"
 				>
 			</File>
@@ -561,6 +565,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\RfpNoConfigTest2.h"
+				>
+			</File>
+			<File
 				RelativePath="RfpOverridesSerializeTest.h"
 				>
 			</File>

