Index: netcdfdataset.cpp
===================================================================
--- netcdfdataset.cpp	(revision 13356)
+++ netcdfdataset.cpp	(working copy)
@@ -90,7 +90,7 @@
     if( bGotGeoTransform )
 	return pszProjection;
     else
-	return "";
+	return GDALPamDataset::GetProjectionRef();
 }
 
 /************************************************************************/
@@ -103,7 +103,10 @@
     if( pbSuccess )
         *pbSuccess = bNoDataSet;
 
-    return dfNoDataValue;
+    if( bNoDataSet )
+        return dfNoDataValue;
+    else
+        return GDALPamRasterBand::GetNoDataValue( pbSuccess );
 }
 
 /************************************************************************/
@@ -897,29 +900,68 @@
 /* -------------------------------------------------------------------- */
 /*      Enable GeoTransform                                             */
 /* -------------------------------------------------------------------- */
+                /* ----------------------------------------------------------*/
+                /*    In the following "actual_range" and "node_offset"      */
+                /*    are attributes used by netCDF files created by GMT.    */
+                /*    If we find them we know how to proceed. Else, use      */
+                /*    the original algorithm.                                */
+                /* --------------------------------------------------------- */
+                double	dummy[2], xMinMax[2], yMinMax[2];
+                int	node_offset = 0;
+
                 poDS->bGotGeoTransform = TRUE;
-		    
-                poDS->adfGeoTransform[0] = pdfXCoord[0];
-                poDS->adfGeoTransform[3] = pdfYCoord[0];
+
+                nc_get_att_int (cdfid, NC_GLOBAL, "node_offset", &node_offset);
+
+                if (!nc_get_att_double (cdfid, nVarDimXID, "actual_range", dummy)) {
+                    xMinMax[0] = dummy[0];		
+                    xMinMax[1] = dummy[1];
+                }
+                else {
+                    xMinMax[0] = pdfXCoord[0];
+                    xMinMax[1] = pdfXCoord[xdim-1];
+                    node_offset = 0;
+                }
+
+                if (!nc_get_att_double (cdfid, nVarDimYID, "actual_range", dummy)) {
+                    yMinMax[0] = dummy[0];		
+                    yMinMax[1] = dummy[1];
+                }
+                else {
+                    yMinMax[0] = pdfYCoord[0];	
+                    yMinMax[1] = pdfYCoord[ydim-1];
+                    node_offset = 0;
+                }
+
+#ifdef notdef
+                // Check for reverse order of y-coordinate
+                if ( yMinMax[0] > yMinMax[1] ) {
+                    dummy[0] = yMinMax[1];
+                    dummy[1] = yMinMax[0];
+                    yMinMax[0] = dummy[0];
+                    yMinMax[1] = dummy[1];
+                }
+#endif
+
+                poDS->adfGeoTransform[0] = xMinMax[0];
                 poDS->adfGeoTransform[2] = 0;
+                poDS->adfGeoTransform[3] = yMinMax[1];
                 poDS->adfGeoTransform[4] = 0;
-                poDS->adfGeoTransform[1] = (( pdfXCoord[xdim-1] - 
-                                              pdfXCoord[0] ) / 
-                                            ( poDS->nRasterXSize - 1 ));
+                poDS->adfGeoTransform[1] = ( xMinMax[1] - xMinMax[0] ) / 
+                    ( poDS->nRasterXSize + (node_offset - 1) );
+                poDS->adfGeoTransform[5] = ( yMinMax[0] - yMinMax[1] ) / 
+                    ( poDS->nRasterYSize + (node_offset - 1) );
 
-                poDS->adfGeoTransform[5] = (( pdfYCoord[ydim-1] - 
-                                              pdfYCoord[0] ) / 
-                                            ( poDS->nRasterYSize - 1 ));
 /* -------------------------------------------------------------------- */
 /*     Compute the center of the pixel                                  */
 /* -------------------------------------------------------------------- */
-                poDS->adfGeoTransform[0] = pdfXCoord[0]
-                    - (poDS->adfGeoTransform[1] / 2);
+                if ( !node_offset ) {	// Otherwise its already the pixel center
+                    poDS->adfGeoTransform[0] -= (poDS->adfGeoTransform[1] / 2);
+                    poDS->adfGeoTransform[3] -= (poDS->adfGeoTransform[5] / 2);
+                }
 
-                poDS->adfGeoTransform[3] = pdfYCoord[0]
-                    - (poDS->adfGeoTransform[5] / 2);
-
                 oSRS.exportToWkt( &(poDS->pszProjection) );
+		    
 	    } 
 	}
 
@@ -1039,7 +1081,7 @@
     if( bGotGeoTransform )
         return CE_None;
     else
-        return CE_Failure;
+        return GDALPamDataset::GetGeoTransform( padfTransform );;
 }
 
 /************************************************************************/
