[GRASS5] datum transforms...

Paul Kelly paul-grass at stjohnspoint.co.uk
Mon Jan 13 09:54:23 EST 2003


Hello Frank

On Mon, 13 Jan 2003, Frank Warmerdam wrote:

> Paul / Eric,
>
> I would prefer to see GRASS use the pj_set_finder() function to install a
> function to find PROJ support files.  This finder function would form the
> path to the PROJ files within the GRASS tree using methods similar to what
> you use to set the PROJ_LIB now.

At last this sounds like an elegant solution! As I see it the finder
function would be very similar to Eric's set_proj_lib_env and would go in
do_proj.c

So before calling pj_transform(), the transform function ( pj_do_proj() )
would have a line something like this:

pj_set_finder( "set_proj_lib" );

and the finder function itself could look like:

#define GRIDDIR "/etc/nad"

const char * set_proj_lib (const char *name)
{
        const char *gisbase = G_gisbase();
        char *buf = NULL;
        size_t len = strlen(gisbase) + sizeof(GRIDDIR)
                     + strlen(name) + 1;
        buf = G_malloc(len);

        sprintf (buf, "%s%s/%s", gisbase, GRIDDIR, name);

        return buf;
}

How does this look?

Paul




More information about the grass-dev mailing list