[GRASS-SVN] r42955 - grass/branches/develbranch_6/vector/v.in.ascii

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jul 31 13:05:40 EDT 2010


Author: hamish
Date: 2010-07-31 17:05:40 +0000 (Sat, 31 Jul 2010)
New Revision: 42955

Modified:
   grass/branches/develbranch_6/vector/v.in.ascii/a2b.c
Log:
accept D:M:S coords in standard mode

Modified: grass/branches/develbranch_6/vector/v.in.ascii/a2b.c
===================================================================
--- grass/branches/develbranch_6/vector/v.in.ascii/a2b.c	2010-07-30 08:30:00 UTC (rev 42954)
+++ grass/branches/develbranch_6/vector/v.in.ascii/a2b.c	2010-07-31 17:05:40 UTC (rev 42955)
@@ -10,6 +10,7 @@
 {
     char ctype;
     char buff[BUFFSIZE];
+    char east_str[256], north_str[256];
     double *xarray;
     double *yarray;
     double *zarray;
@@ -108,9 +109,19 @@
 	    }
 
 	    *z = 0;
-	    if (sscanf(buff, "%lf%lf%lf", x, y, z) < 2)
-		G_fatal_error(_("Error reading ASCII file: (bad point) [%s]"),
-			      buff);
+	    if (sscanf(buff, "%lf%lf%lf", x, y, z) < 2) {
+		if (sscanf(buff, " %s %s %lf", east_str, north_str, z) < 2) {
+		    G_fatal_error(_("Error reading ASCII file: (bad point) [%s]"),
+				  buff);
+		} else {
+		    if( ! G_scan_easting(east_str, x, G_projection()) )
+			G_fatal_error(_("Unparsable longitude value: [%s]"),
+				      east_str);
+		    if( ! G_scan_northing(north_str, y, G_projection()) )
+			G_fatal_error(_("Unparsable latitude value: [%s]"),
+				      north_str);
+		}
+	    }
 
 	    G_debug(5, "coor in: %s -> x = %f y = %f z = %f", G_chop(buff),
 		    *x, *y, *z);



More information about the grass-commit mailing list