[GRASS-SVN] r50479 - grass/branches/develbranch_6/vector/v.info

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 27 02:58:12 EST 2012


Author: hamish
Date: 2012-01-26 23:58:12 -0800 (Thu, 26 Jan 2012)
New Revision: 50479

Modified:
   grass/branches/develbranch_6/vector/v.info/main.c
Log:
handle case of unspecified UTM zone better

Modified: grass/branches/develbranch_6/vector/v.info/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.info/main.c	2012-01-27 06:55:53 UTC (rev 50478)
+++ grass/branches/develbranch_6/vector/v.info/main.c	2012-01-27 07:58:12 UTC (rev 50479)
@@ -56,6 +56,7 @@
     dbTable *table;
     int field, num_dblinks, ncols, col;
     char tmp1[100], tmp2[100];
+    int utm_zone = -1;
 
     G_gisinit(argv[0]);
 
@@ -298,12 +299,24 @@
 	    }
 
 	    printline("");
-	    if (G_projection() == PROJECTION_UTM)
-		sprintf(line, _("        Projection: %s (zone %d)"),
-			G_database_projection_name(), G_zone());
+	    /* this differs from r.info in that proj info IS taken from the map here, not the location settings */
+	    /* Vect_get_proj_name() and _zone() are typically unset?! */
+	    if (G_projection() == PROJECTION_UTM) {
+		utm_zone = Vect_get_zone(&Map);
+		if (utm_zone < 0 || utm_zone > 60)
+		    strcpy(tmp1, _("invalid"));
+		else if (utm_zone == 0)
+		    strcpy(tmp1, _("unspecified"));
+		else
+		    sprintf(tmp1, "%d", utm_zone);
+
+		sprintf(line, "        %s: %s (%s %s)",
+		    _("Projection"), Vect_get_proj_name(&Map),
+		    _("zone"), tmp1);
+	    }
 	    else
 		sprintf(line, _("        Projection: %s"),
-			G_database_projection_name());
+			Vect_get_proj_name(&Map));
 	    printline(line);
 
 	    Vect_get_map_box(&Map, &box);



More information about the grass-commit mailing list