[GRASS-SVN] r42956 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jul 31 13:13:09 EDT 2010
Author: hamish
Date: 2010-07-31 17:13:09 +0000 (Sat, 31 Jul 2010)
New Revision: 42956
Modified:
grass/trunk/lib/vector/Vlib/ascii.c
Log:
accept D:M:S coords in standard mode (merge from devbr6)
Modified: grass/trunk/lib/vector/Vlib/ascii.c
===================================================================
--- grass/trunk/lib/vector/Vlib/ascii.c 2010-07-31 17:05:40 UTC (rev 42955)
+++ grass/trunk/lib/vector/Vlib/ascii.c 2010-07-31 17:13:09 UTC (rev 42956)
@@ -37,6 +37,7 @@
{
char ctype;
char buff[BUFFSIZE];
+ char east_str[256], north_str[256];
double *xarray;
double *yarray;
double *zarray;
@@ -61,6 +62,8 @@
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 @@
}
*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