[GRASS-SVN] r52869 - grass/trunk/vector/v.what.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 24 02:24:44 PDT 2012


Author: mmetz
Date: 2012-08-24 02:24:44 -0700 (Fri, 24 Aug 2012)
New Revision: 52869

Modified:
   grass/trunk/vector/v.what.rast/main.c
Log:
v.what.rast: fix fp precision

Modified: grass/trunk/vector/v.what.rast/main.c
===================================================================
--- grass/trunk/vector/v.what.rast/main.c	2012-08-23 22:12:08 UTC (rev 52868)
+++ grass/trunk/vector/v.what.rast/main.c	2012-08-24 09:24:44 UTC (rev 52869)
@@ -124,11 +124,11 @@
     fd = Rast_open_old(opt.rast->answer, "");
 
     out_type = Rast_get_map_type(fd);
-    
-    width = 7;
-    if (out_type == DCELL_TYPE)
-	width = 15;
 
+    width = 15;
+    if (out_type == FCELL_TYPE)
+	width = 7;
+
     /* TODO: Later possibly category labels */
     /* 
        if ( Rast_read_cats (name, "", &RCats) < 0 )
@@ -323,7 +323,7 @@
 		sprintf(buf, "NULL");
 	    }
 	    else {
-		sprintf(buf, "%.*f", width, cache[point].dvalue);
+		sprintf(buf, "%.*g", width, cache[point].dvalue);
 	    }
 	}
 	db_append_string(&stmt, buf);



More information about the grass-commit mailing list