Index: ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp
===================================================================
--- ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp	(revision 23285)
+++ ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp	(working copy)
@@ -28,6 +28,7 @@
  ****************************************************************************/
 #include "ogrgeojsonutils.h"
 #include <cpl_port.h>
+#include <cpl_string.h>
 #include <cpl_conv.h>
 #include <ogr_geometry.h>
 #include <jsonc/json.h> // JSON-C
@@ -49,10 +50,69 @@
 
     if( EQUALN( pszText, "{", 1) )
         return TRUE;
-
+    
     return FALSE;
 }
 
+int GeoJSONFileIsObject( const char* pszSource )
+{
+    CPLAssert( NULL != pszSource );
+
+    VSILFILE* fp = NULL;
+    fp = VSIFOpenL( pszSource, "rb" );
+    if( NULL == fp )
+    {
+        return FALSE;
+    }
+    
+    // by default read first 5000 bytes
+    // 5000 was chose as enough bytes to 
+    // enable all current tests to pass
+    vsi_l_offset nReadLen = 5000;
+    vsi_l_offset nDataLen = 0;
+    
+    VSIFSeekL( fp, 0, SEEK_END );
+    nDataLen = VSIFTellL( fp );
+    
+    if ( nDataLen > (vsi_l_offset)(size_t)nDataLen )
+    {
+        VSIFCloseL( fp );
+        return FALSE;
+    }
+    
+    // do not read off the end of the file
+    if (nReadLen > nDataLen)
+        nReadLen = nDataLen;
+    
+    VSIFSeekL( fp, 0, SEEK_SET );
+    
+    char* pszGeoData = (char*)VSIMalloc((size_t)(nReadLen + 1));
+    if( NULL == pszGeoData )
+    {
+        VSIFCloseL(fp);
+        return FALSE;
+    }
+    
+    pszGeoData[nReadLen] = '\0';
+    if( ( nDataLen != VSIFReadL( pszGeoData, 1, (size_t)nReadLen, fp ) ) )
+    {
+        VSIFCloseL( fp );
+        return FALSE;
+    }
+    VSIFCloseL( fp );
+    
+    int ret = 0;
+    
+    CPLString search(pszGeoData);
+    if ((search.ifind("\"type\"") && search.ifind("\"coordinates\""))
+        || search.ifind("\"FeatureCollection\""))
+        ret = 1;
+    
+    CPLAssert( NULL != pszGeoData );
+    CPLFree( pszGeoData );
+    return ret;
+}
+
 /************************************************************************/
 /*                           GeoJSONGetSourceType()                     */
 /************************************************************************/
@@ -76,11 +136,14 @@
     {
         srcType = eGeoJSONSourceFile;
     }
-    else
+    else if( GeoJSONIsObject( pszSource ) )
     {
-        if( GeoJSONIsObject( pszSource ) )
-            srcType = eGeoJSONSourceText;
+        srcType = eGeoJSONSourceText;
     }
+    else if ( GeoJSONFileIsObject( pszSource ))
+    {
+        srcType = eGeoJSONSourceFile;
+    }
 
     return srcType;
 }
