[GRASS-SVN] r71553 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 13 12:56:03 PDT 2017
Author: mmetz
Date: 2017-10-13 12:56:03 -0700 (Fri, 13 Oct 2017)
New Revision: 71553
Modified:
grass/trunk/lib/gis/make_loc.c
Log:
libgis: add tests for reference longitude/latitudes to G_compare_projections()
Modified: grass/trunk/lib/gis/make_loc.c
===================================================================
--- grass/trunk/lib/gis/make_loc.c 2017-10-12 20:18:46 UTC (rev 71552)
+++ grass/trunk/lib/gis/make_loc.c 2017-10-13 19:56:03 UTC (rev 71553)
@@ -107,6 +107,8 @@
* \return -6 if UTM hemisphere differs,
* \return -7 if false easting differs
* \return -8 if false northing differs,
+ * \return -9 if reference longitude differs,
+ * \return -10 if one of the reference latitudes differs,
* \return 1 if projections match.
*/
int G_compare_projections(const struct Key_Value *proj_info1,
@@ -216,6 +218,51 @@
}
/* -------------------------------------------------------------------- */
+ /* Do they have the same reference longitude? */
+ /* -------------------------------------------------------------------- */
+
+ {
+ const char *l_0_1 = NULL, *l_0_2 = NULL;
+
+ l_0_1 = G_find_key_value("lon_0", proj_info1);
+ l_0_2 = G_find_key_value("lon_0", proj_info2);
+
+ if (l_0_1 && l_0_2 && (fabs(atof(l_0_1) - atof(l_0_2)) > 0.000001))
+ return -9;
+ }
+
+ /* -------------------------------------------------------------------- */
+ /* Do they have the same reference latitudes? */
+ /* -------------------------------------------------------------------- */
+
+ {
+ const char *l_1 = NULL, *l_2 = NULL;
+
+ /* center latitude */
+ l_1 = G_find_key_value("lat_0", proj_info1);
+ l_2 = G_find_key_value("lat_0", proj_info2);
+
+ if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
+ return -10;
+
+ /* standard pallel 1 */
+ l_1 = l_2 = NULL;
+ l_1 = G_find_key_value("lat_1", proj_info1);
+ l_2 = G_find_key_value("lat_1", proj_info2);
+
+ if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
+ return -10;
+
+ /* standard pallel 2 */
+ l_1 = l_2 = NULL;
+ l_1 = G_find_key_value("lat_2", proj_info1);
+ l_2 = G_find_key_value("lat_2", proj_info2);
+
+ if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
+ return -10;
+ }
+
+ /* -------------------------------------------------------------------- */
/* Add more details in later. */
/* -------------------------------------------------------------------- */
More information about the grass-commit
mailing list