[GRASS5] [bug #3302] (grass) cs2cs with GRASS and NTv2 grid fails

Paul Kelly paul-grass at stjohnspoint.co.uk
Wed Jun 8 20:39:25 EDT 2005


On Thu, 9 Jun 2005, Hamish wrote:

> from the cs2cs man page:
>
>      "The   environment   parameter
>       PROJ_LIB establishes the default directory for a
>       file reference without an absolute  path.   This
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
>       is  also  used  for  supporting files like datum
>       shift files."
>
>
> I take that to mean it is intended.

It would seem so.

>> would be to change pj_get_kv() (which is called by g.proj) to prepend
>> $GISBASE/etc/nad/ to the name of the gridshift file when it prepares
>> the PROJ string, and to do away with pj_set_finder().
>
> If you say so, you're the expert.

Untested (very simple) patch attached. On second thoughts even if we put 
the full path in by default, it is probably best to keep pj_set_finder() 
for odd circumstances in PROJ_INFO files, e.g. it would be hard to catch
datumparams: nadgrids=conus
which has been valid up to now.

Paul
-------------- next part --------------
Index: include/gprojects.h
===================================================================
RCS file: /grassrepository/grass6/include/gprojects.h,v
retrieving revision 1.5
diff -u -r1.5 gprojects.h
--- include/gprojects.h	26 Jan 2004 15:37:12 -0000	1.5
+++ include/gprojects.h	9 Jun 2005 00:33:59 -0000
@@ -26,6 +26,8 @@
 #define ELLIPSOIDTABLE "/etc/ellipse.table"
 #define DATUMTABLE "/etc/datum.table"
 #define DATUMTRANSFORMTABLE "/etc/datumtransform.table"
+/* GRASS relative location of datum conversion lookup tables */
+#define GRIDDIR "/etc/nad"
 
 struct pj_info {
       projPJ     *pj;
Index: lib/proj/datum.c
===================================================================
RCS file: /grassrepository/grass6/lib/proj/datum.c,v
retrieving revision 1.2
diff -u -r1.2 datum.c
--- lib/proj/datum.c	26 Jan 2004 15:37:12 -0000	1.2
+++ lib/proj/datum.c	9 Jun 2005 00:33:59 -0000
@@ -167,7 +167,9 @@
 	returnval = 2;
     }
     else if (G_find_key_value("nadgrids", projinfo) != NULL) {
-	G_asprintf(params, "nadgrids=%s",
+	const char *gisbase = G_gisbase();
+       
+	G_asprintf(params, "nadgrids=%s%s/%s", gisbase, GRIDDIR,
 		   G_find_key_value("nadgrids", projinfo));
 	returnval = 2;
     }
Index: lib/proj/get_proj.c
===================================================================
RCS file: /grassrepository/grass6/lib/proj/get_proj.c,v
retrieving revision 1.3
diff -u -r1.3 get_proj.c
--- lib/proj/get_proj.c	26 Jan 2004 15:37:12 -0000	1.3
+++ lib/proj/get_proj.c	9 Jun 2005 00:34:00 -0000
@@ -25,8 +25,6 @@
 #include "gprojects.h"
 #define MAIN
 
-/* GRASS relative location of datum conversion lookup tables */
-#define GRIDDIR "/etc/nad"
 /* Finder function for datum conversion lookup tables */
 #define FINDERFUNC set_proj_lib
 #define PERMANENT "PERMANENT"


More information about the grass-dev mailing list