[GRASS-SVN] r45023 - grass/trunk/imagery/i.latlong

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 13 20:34:57 EST 2011


Author: ychemin
Date: 2011-01-13 17:34:57 -0800 (Thu, 13 Jan 2011)
New Revision: 45023

Modified:
   grass/trunk/imagery/i.latlong/main.c
Log:
Fixed bug when already lat/long input map

Modified: grass/trunk/imagery/i.latlong/main.c
===================================================================
--- grass/trunk/imagery/i.latlong/main.c	2011-01-14 00:19:08 UTC (rev 45022)
+++ grass/trunk/imagery/i.latlong/main.c	2011-01-14 01:34:57 UTC (rev 45023)
@@ -83,14 +83,14 @@
     inrast = Rast_allocate_d_buf();
     
     /***************************************************/ 
-    stepx = cellhd.ew_res;
-    stepy = cellhd.ns_res;
     xmin = cellhd.west;
     xmax = cellhd.east;
     ymin = cellhd.south;
     ymax = cellhd.north;
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
+    stepx = abs(xmax-xmin)*(double)ncols;
+    stepy = abs(ymax-ymin)*(double)nrows;
     
     /*Stolen from r.sun */ 
     /* Set up parameters for projection to lat/long if necessary */ 
@@ -127,8 +127,8 @@
 
 	for (col = 0; col < ncols; col++)
         {
-	    latitude = ymax - (row * stepy);
-	    longitude = xmin + (col * stepx);
+	    latitude = ymax - ((double)row * stepy);
+	    longitude = xmin + ((double)col * stepx);
 	    if (not_ll) 
 		if (pj_do_proj(&longitude, &latitude, &iproj, &oproj) < 0) 
 		    G_fatal_error(_("Error in pj_do_proj"));



More information about the grass-commit mailing list