[GRASS-SVN] r61861 - grass/trunk/vector/v.distance

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Sep 11 02:52:40 PDT 2014


Author: mmetz
Date: 2014-09-11 02:52:40 -0700 (Thu, 11 Sep 2014)
New Revision: 61861

Modified:
   grass/trunk/vector/v.distance/main.c
Log:
v.distance: fix geodesic distance

Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c	2014-09-11 09:16:44 UTC (rev 61860)
+++ grass/trunk/vector/v.distance/main.c	2014-09-11 09:52:40 UTC (rev 61861)
@@ -363,6 +363,24 @@
 
 	dx = fbox.E - fbox.W;
 	dy = fbox.N - fbox.S;
+
+	if (geodesic) {
+	    double d;
+	    
+	    G_begin_distance_calculations();
+	    dx = G_distance(fbox.W, fbox.S, fbox.E, fbox.S);
+	    d = G_distance(fbox.W, fbox.N, fbox.E, fbox.N);
+	    
+	    if (dx < d)
+		dx = d;
+
+	    dy = G_distance(fbox.W, fbox.S, fbox.W, fbox.N);
+	    d = G_distance(fbox.E, fbox.S, fbox.E, fbox.N);
+	    
+	    if (dy < d)
+		dy = d;
+	}
+
 	if (Vect_is_3d(&From))
 	    dz = fbox.T - fbox.B;
 	else



More information about the grass-commit mailing list