[GRASS-SVN] r72598 - grass/trunk/raster/r.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Apr 8 06:47:32 PDT 2018


Author: mmetz
Date: 2018-04-08 06:47:32 -0700 (Sun, 08 Apr 2018)
New Revision: 72598

Modified:
   grass/trunk/raster/r.proj/main.c
Log:
r.proj: +option for user-defined PROJ pipeline

Modified: grass/trunk/raster/r.proj/main.c
===================================================================
--- grass/trunk/raster/r.proj/main.c	2018-04-08 13:45:58 UTC (rev 72597)
+++ grass/trunk/raster/r.proj/main.c	2018-04-08 13:47:32 UTC (rev 72598)
@@ -131,10 +131,12 @@
      *inlocation,		/* name of input location       */
      *outmap,			/* name of output layer         */
      *indbase,			/* name of input database       */
-     *interpol,			/* interpolation method:
-				   nearest neighbor, bilinear, cubic */
+     *interpol,			/* interpolation method         */
      *memory,			/* amount of memory for cache   */
      *res;			/* resolution of target map     */
+#ifdef HAVE_PROJ_H
+    struct Option *pipeline;	/* name of custom PROJ pipeline */
+#endif
     struct Cell_head incellhd,	/* cell header of input map     */
       outcellhd;		/* and output map               */
 
@@ -199,6 +201,14 @@
     res->description = _("Resolution of output raster map");
     res->guisection = _("Target");
 
+#ifdef HAVE_PROJ_H
+    pipeline = G_define_option();
+    pipeline->key = "pipeline";
+    pipeline->type = TYPE_STRING;
+    pipeline->required = NO;
+    pipeline->description = _("PROJ pipeline for coordinate transformation");
+#endif
+
     list = G_define_flag();
     list->key = 'l';
     list->description = _("List raster maps in input mapset and exit");
@@ -285,13 +295,13 @@
     /* if requested, list the raster maps in source location - MN 5/2001 */
     if (list->answer) {
 	int i;
-	char **list;
+	char **srclist;
 	G_verbose_message(_("Checking location <%s> mapset <%s>"),
 			  inlocation->answer, setname);
-	list = G_list(G_ELEMENT_RASTER, G_getenv_nofatal("GISDBASE"),
+	srclist = G_list(G_ELEMENT_RASTER, G_getenv_nofatal("GISDBASE"),
 		      G_getenv_nofatal("LOCATION_NAME"), setname);
-	for (i = 0; list[i]; i++) {
-	    fprintf(stdout, "%s\n", list[i]);
+	for (i = 0; srclist[i]; i++) {
+	    fprintf(stdout, "%s\n", srclist	[i]);
 	}
 	fflush(stdout);
 	exit(EXIT_SUCCESS);	/* leave r.proj after listing */
@@ -317,6 +327,12 @@
     if (pj_get_kv(&iproj, in_proj_info, in_unit_info) < 0)
 	G_fatal_error(_("Unable to get projection key values of input map"));
 
+    tproj.def = NULL;
+#ifdef HAVE_PROJ_H
+    if (pipeline->answer) {
+	tproj.def = G_store(pipeline->answer);
+    }
+#endif
     if (GPJ_init_transform(&iproj, &oproj, &tproj) < 0)
 	G_fatal_error(_("Unable to initialize coordinate transformation"));
 



More information about the grass-commit mailing list