[GRASS-SVN] r57191 - in grass-addons/grass6/imagery: . i.latlong

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 17 06:19:36 PDT 2013


Author: neteler
Date: 2013-07-17 06:19:36 -0700 (Wed, 17 Jul 2013)
New Revision: 57191

Added:
   grass-addons/grass6/imagery/i.latlong/
   grass-addons/grass6/imagery/i.latlong/description.html
Removed:
   grass-addons/grass6/imagery/i.latlong/i.latlong.html
Modified:
   grass-addons/grass6/imagery/Makefile
   grass-addons/grass6/imagery/i.latlong/main.c
Log:
i.latlong: backport to GRASS 6

Modified: grass-addons/grass6/imagery/Makefile
===================================================================
--- grass-addons/grass6/imagery/Makefile	2013-07-17 12:12:45 UTC (rev 57190)
+++ grass-addons/grass6/imagery/Makefile	2013-07-17 13:19:36 UTC (rev 57191)
@@ -1,6 +1,7 @@
 MODULE_TOPDIR = ..
 
 SUBDIRS = \
+	i.latlong \
 	i.homography \
 	i.landsat.dehaze \
 	i.points.auto \

Copied: grass-addons/grass6/imagery/i.latlong/description.html (from rev 57186, grass/trunk/imagery/i.latlong/i.latlong.html)
===================================================================
--- grass-addons/grass6/imagery/i.latlong/description.html	                        (rev 0)
+++ grass-addons/grass6/imagery/i.latlong/description.html	2013-07-17 13:19:36 UTC (rev 57191)
@@ -0,0 +1,32 @@
+<h2>DESCRIPTION</h2>
+
+<em>i.latlong</em> creates a latitude (degree decimal) map, or longitude
+if the -l flag is used, from any map in any projection using PROJ.4 library. 
+This is an input to <em>r.sun</em> and <em>i.evapo.potrad</em>.
+
+<h2>NOTES</h2>
+
+The PROJ.4 <a href="http://trac.osgeo.org/proj/">website</a>.
+
+<h2>TODO</h2>
+Datum transform is not implemented, the same datum is taken as output.
+
+<h2>EXAMPLE</h2>
+
+<div class="code"><pre>
+g.region rast=elevation -p
+i.latlong input=elevation output=latitude
+</pre></div>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="r.sun.html">r.sun</a>,
+<a href="r.sunhours.html">r.sunhours</a>
+</em>
+
+<h2>AUTHORS</h2>
+
+Yann Chemin, International Rice Research Institute, The Philippines
+
+<p><i>Last changed: $Date$</i>

Deleted: grass-addons/grass6/imagery/i.latlong/i.latlong.html
===================================================================
--- grass/trunk/imagery/i.latlong/i.latlong.html	2013-07-17 10:08:51 UTC (rev 57186)
+++ grass-addons/grass6/imagery/i.latlong/i.latlong.html	2013-07-17 13:19:36 UTC (rev 57191)
@@ -1,32 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>i.latlong</em> creates a latitude (degree decimal) map, or longitude
-if the -l flag is used, from any map in any projection using PROJ.4 library. 
-This is an input to <em>r.sun</em> and <em>i.evapo.potrad</em>.
-
-<h2>NOTES</h2>
-
-The PROJ.4 <a href="http://trac.osgeo.org/proj/">website</a>.
-
-<h2>TODO</h2>
-Datum transform is not implemented, the same datum is taken as output.
-
-<h2>EXAMPLE</h2>
-
-<div class="code"><pre>
-g.region rast=elevation -p
-i.latlong input=elevation output=latitude
-</pre></div>
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="r.sun.html">r.sun</a>,
-<a href="r.sunhours.html">r.sunhours</a>
-</em>
-
-<h2>AUTHORS</h2>
-
-Yann Chemin, International Rice Research Institute, The Philippines
-
-<p><i>Last changed: $Date$</i>

Modified: grass-addons/grass6/imagery/i.latlong/main.c
===================================================================
--- grass/trunk/imagery/i.latlong/main.c	2013-07-17 10:08:51 UTC (rev 57186)
+++ grass-addons/grass6/imagery/i.latlong/main.c	2013-07-17 13:19:36 UTC (rev 57191)
@@ -16,11 +16,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
-#include <grass/raster.h>
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
 
-int main(int argc, char *argv[]) 
+int main(int argc, char *argv[])
 {
     struct Cell_head cellhd;	/*region+header info */
     int nrows, ncols;
@@ -53,10 +52,7 @@
     G_gisinit(argv[0]);
 
     module = G_define_module();
-    G_add_keyword(_("imagery"));
-    G_add_keyword(_("latitude"));
-    G_add_keyword(_("longitude"));
-    G_add_keyword(_("projection"));
+    module->keywords = _("imagery, latitude, longitude, projection");
     module->description = _("Creates a latitude/longitude raster map.");
     
     /* Define the different options */ 
@@ -77,17 +73,17 @@
     result1 = output1->answer;
 
     /***************************************************/ 
-    infd = Rast_open_old(in, "");
-    Rast_get_cellhd(in, "", &cellhd);
-    inrast = Rast_allocate_d_buf();
+    infd = G_open_cell_old(in, "");
+    G_get_cellhd(in, "", &cellhd);
+    inrast = G_allocate_d_raster_buf();
     
     /***************************************************/ 
     xmin = cellhd.west;
     xmax = cellhd.east;
     ymin = cellhd.south;
     ymax = cellhd.north;
-    nrows = Rast_window_rows();
-    ncols = Rast_window_cols();
+    nrows = G_window_rows();
+    ncols = G_window_cols();
     stepx = abs(xmax-xmin)/(double)ncols;
     stepy = abs(ymax-ymin)/(double)nrows;
     
@@ -114,15 +110,15 @@
 	    G_fatal_error(_("Unable to set up lat/long projection parameters"));
     }	/* End of stolen from r.sun */
 
-    outrast1 = Rast_allocate_d_buf();
+    outrast1 = G_allocate_d_raster_buf();
 
-    outfd1 = Rast_open_new(result1, DCELL_TYPE);
+    outfd1 = G_open_raster_new(result1, DCELL_TYPE);
 
     for (row = 0; row < nrows; row++)
     {
 	G_percent(row, nrows, 2);
 
-	Rast_get_d_row(infd, inrast, row);
+	G_get_d_raster_row(infd, inrast, row);
 
 	for (col = 0; col < ncols; col++)
         {
@@ -137,16 +133,16 @@
 	        d = latitude;
 	    outrast1[col] = d;
 	}
-	Rast_put_d_row(outfd1, outrast1);
+	G_put_d_raster_row(outfd1, outrast1);
     }
     G_free(inrast);
-    Rast_close(infd);
+    G_close_cell(infd);
     G_free(outrast1);
-    Rast_close(outfd1);
+    G_close_cell(outfd1);
 
-    Rast_short_history(result1, "raster", &history);
-    Rast_command_history(&history);
-    Rast_write_history(result1, &history);
+    G_short_history(result1, "raster", &history);
+    G_command_history(&history);
+    G_write_history(result1, &history);
 
     exit(EXIT_SUCCESS);
 }



More information about the grass-commit mailing list