Bladeren bron

accept D:M:S coords in standard mode (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42956 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 14 jaren geleden
bovenliggende
commit
92ba88a4e4
1 gewijzigde bestanden met toevoegingen van 16 en 3 verwijderingen
  1. 16 3
      lib/vector/Vlib/ascii.c

+ 16 - 3
lib/vector/Vlib/ascii.c

@@ -37,6 +37,7 @@ int Vect_read_ascii(FILE *ascii, struct Map_info *Map)
 {
     char ctype;
     char buff[BUFFSIZE];
+    char east_str[256], north_str[256];
     double *xarray;
     double *yarray;
     double *zarray;
@@ -61,6 +62,8 @@ int Vect_read_ascii(FILE *ascii, struct Map_info *Map)
     zarray = (double *)G_calloc(alloc_points, sizeof(double));
 
     n_lines = 0;
+
+
     while (G_getl2(buff, BUFFSIZE - 1, ascii) != 0) {
 	n_cats = 0;
 	if (buff[0] == '\0') {
@@ -134,9 +137,19 @@ int Vect_read_ascii(FILE *ascii, struct Map_info *Map)
 	    }
 
 	    *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);