[GRASS-SVN] r71656 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 10 10:36:48 PST 2017


Author: mmetz
Date: 2017-11-10 10:36:48 -0800 (Fri, 10 Nov 2017)
New Revision: 71656

Modified:
   grass/trunk/lib/gis/make_loc.c
Log:
gislib: account for swapped lat_1, lat_2 in G_compare_projections()

Modified: grass/trunk/lib/gis/make_loc.c
===================================================================
--- grass/trunk/lib/gis/make_loc.c	2017-11-10 15:23:51 UTC (rev 71655)
+++ grass/trunk/lib/gis/make_loc.c	2017-11-10 18:36:48 UTC (rev 71656)
@@ -326,7 +326,7 @@
 	    return -10;
 
     /* -------------------------------------------------------------------- */
-    /*      Do they have the same standard parallels?                    */
+    /*      Do they have the same standard parallels?                       */
     /* -------------------------------------------------------------------- */
 
 	l_1 = l_2 = NULL;
@@ -336,8 +336,17 @@
 	if ((l_1 && !l_2) || (!l_1 && l_2))
 	    return -11;
 
-	if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
-	    return -11;
+	if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001)) {
+	    /* lat_1 differ */
+	    /* check for swapped lat_1, lat_2 */
+	    l_2 = G_find_key_value("lat_2", proj_info2);
+	    
+	    if (!l_2)
+		return -11;
+	    if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001)) {
+		return -11;
+	    }
+	}
 
 	l_1 = l_2 = NULL;
 	l_1 = G_find_key_value("lat_2", proj_info1);
@@ -346,8 +355,17 @@
 	if ((l_1 && !l_2) || (!l_1 && l_2))
 	    return -11;
 
-	if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
-	    return -11;
+	if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001)) {
+	    /* lat_2 differ */
+	    /* check for swapped lat_1, lat_2 */
+	    l_2 = G_find_key_value("lat_1", proj_info2);
+	    
+	    if (!l_2)
+		return -11;
+	    if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001)) {
+		return -11;
+	    }
+	}
     }
 
     /* towgs84 ? */



More information about the grass-commit mailing list