[GRASS-SVN] r72597 - grass/trunk/lib/proj

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Apr 8 06:45:58 PDT 2018


Author: mmetz
Date: 2018-04-08 06:45:58 -0700 (Sun, 08 Apr 2018)
New Revision: 72597

Modified:
   grass/trunk/lib/proj/do_proj.c
Log:
libproj: support user-defined PROJ pipelines

Modified: grass/trunk/lib/proj/do_proj.c
===================================================================
--- grass/trunk/lib/proj/do_proj.c	2018-04-06 18:13:00 UTC (rev 72596)
+++ grass/trunk/lib/proj/do_proj.c	2018-04-08 13:45:58 UTC (rev 72597)
@@ -68,6 +68,8 @@
  *         converts from ll to a given SRS, not from a given SRS to ll
  *         thus PROJ 5+ itself uses an inverse transformation in the
  *         first step of the pipeline for proj_create_crs_to_crs()
+ *   if info_trans->def is not NULL, this pipeline definition will be 
+ *   used to create a transformation object 
  * PROJ 4:
  *   info_in->pj must not be null
  *   if info_out->pj is null, create info_out as ll equivalent
@@ -87,13 +89,15 @@
 	G_fatal_error(_("Input coordinate system is NULL"));
 
 #ifdef HAVE_PROJ_H
-    if (info_out->pj != NULL && info_out->def != NULL)
-	G_asprintf(&(info_trans->def), "+proj=pipeline +step +inv %s +step %s",
-		   info_in->def, info_out->def);
-    else
-	/* assume info_out to be ll equivalent of info_in */
-	G_asprintf(&(info_trans->def), "+proj=pipeline +step +inv %s",
-		   info_in->def);
+    if (!info_trans->def) {
+	if (info_out->pj != NULL && info_out->def != NULL)
+	    G_asprintf(&(info_trans->def), "+proj=pipeline +step +inv %s +step %s",
+		       info_in->def, info_out->def);
+	else
+	    /* assume info_out to be ll equivalent of info_in */
+	    G_asprintf(&(info_trans->def), "+proj=pipeline +step +inv %s",
+		       info_in->def);
+    }
 
     info_trans->pj = proj_create(PJ_DEFAULT_CTX, info_trans->def);
     if (info_trans->pj == NULL) {



More information about the grass-commit mailing list