[GRASS-SVN] r47886 - grass/branches/develbranch_6/raster/r.in.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 25 08:30:35 EDT 2011


Author: neteler
Date: 2011-08-25 05:30:34 -0700 (Thu, 25 Aug 2011)
New Revision: 47886

Modified:
   grass/branches/develbranch_6/raster/r.in.gdal/main.c
Log:
parser cosmetics; better handling of flipped/rotated maps (backport of r34740)

Modified: grass/branches/develbranch_6/raster/r.in.gdal/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.in.gdal/main.c	2011-08-25 12:30:19 UTC (rev 47885)
+++ grass/branches/develbranch_6/raster/r.in.gdal/main.c	2011-08-25 12:30:34 UTC (rev 47886)
@@ -111,6 +111,7 @@
     parm.target->required = NO;
     parm.target->description =
 	_("Name of location to read projection from for GCPs transformation");
+    parm.target->key_desc = "name";
 
     parm.title = G_define_option();
     parm.title->key = "title";
@@ -125,6 +126,7 @@
     parm.outloc->type = TYPE_STRING;
     parm.outloc->required = NO;
     parm.outloc->description = _("Name for new location to create");
+    parm.outloc->key_desc = "name";
 
     flag_o = G_define_flag();
     flag_o->key = 'o';
@@ -256,10 +258,10 @@
     cellhd.cols = GDALGetRasterXSize(hDS);
     cellhd.cols3 = GDALGetRasterXSize(hDS);
 
-    if (GDALGetGeoTransform(hDS, adfGeoTransform) == CE_None
-	&& adfGeoTransform[5] < 0.0) {
-	if (adfGeoTransform[2] != 0.0 || adfGeoTransform[4] != 0.0)
-	    G_fatal_error(_("Input raster map is rotated - cannot import. "
+    if (GDALGetGeoTransform(hDS, adfGeoTransform) == CE_None) {
+	if (adfGeoTransform[2] != 0.0 || adfGeoTransform[4] != 0.0 ||
+	    adfGeoTransform[1] <= 0.0 || adfGeoTransform[5] >= 0.0)
+	    G_fatal_error(_("Input raster map is flipped or rotated - cannot import. "
 			    "You may use 'gdalwarp' to transform the map to North-up."));
 
 	cellhd.north = adfGeoTransform[3];
@@ -267,8 +269,8 @@
 	cellhd.ns_res3 = fabs(adfGeoTransform[5]);
 	cellhd.south = cellhd.north - cellhd.ns_res * cellhd.rows;
 	cellhd.west = adfGeoTransform[0];
-	cellhd.ew_res = adfGeoTransform[1];
-	cellhd.ew_res3 = adfGeoTransform[1];
+	cellhd.ew_res = fabs(adfGeoTransform[1]);
+	cellhd.ew_res3 = fabs(adfGeoTransform[1]);
 	cellhd.east = cellhd.west + cellhd.cols * cellhd.ew_res;
 	cellhd.top = 1.;
 	cellhd.bottom = 0.;



More information about the grass-commit mailing list