GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/gprojects.h>
#include "local_proto.h"
Go to the source code of this file.
Functions | |
int | GPJ_get_datum_by_name (const char *name, struct gpj_datum *dstruct) |
Look up a string in datum.table file to see if it is a valid datum name and if so place its information into a gpj_datum struct. More... | |
int | GPJ_get_default_datum_params_by_name (const char *name, char **params) |
"Last resort" function to retrieve a "default" set of datum parameters for a datum (N.B. there really is no such thing as a catch-all default!) More... | |
int | GPJ_get_datum_params (char **name, char **params) |
Extract the datum transformation-related parameters for the current location. More... | |
int | GPJ__get_datum_params (struct Key_Value *projinfo, char **datumname, char **params) |
Extract the datum transformation-related parameters from a set of general PROJ_INFO parameters. More... | |
int | GPJ_ask_datum_params (const char *datumname, char **params) |
Interactively ask for datum parameters for a particular datum. More... | |
struct gpj_datum_transform_list * | GPJ_get_datum_transform_by_name (const char *inputname) |
Internal function to find all possible sets of transformation parameters for a particular datum. More... | |
void | GPJ_free_datum_transform (struct gpj_datum_transform_list *item) |
Free the memory used by a gpj_datum_transform_list struct. More... | |
struct datum_list * | read_datum_table (void) |
Read the current GRASS datum.table from disk and store in memory. More... | |
void | GPJ_free_datum (struct gpj_datum *dstruct) |
Free the memory used for the strings in a gpj_datum struct. More... | |
void | free_datum_list (struct datum_list *dstruct) |
Free the memory used by a datum_list linked list structure. More... | |
void free_datum_list | ( | struct datum_list * | dstruct | ) |
Free the memory used by a datum_list linked list structure.
dstruct | datum_list struct to be freed |
Definition at line 557 of file proj/datum.c.
References datum_list::ellps, G_free(), datum_list::longname, datum_list::name, datum_list::next, NULL, and old.
Referenced by GPJ_get_datum_by_name(), and GPJ_osr_to_grass().
int GPJ__get_datum_params | ( | struct Key_Value * | projinfo, |
char ** | datumname, | ||
char ** | params | ||
) |
Extract the datum transformation-related parameters from a set of general PROJ_INFO parameters.
This function can be used to test if a location's co-ordinate system set-up supports datum transformation.
projinfo | Set of key_value pairs containing projection information in PROJ_INFO file format |
datumname | Pointer to a pointer which will have memory allocated and into which a string containing the datum name (if present) will be placed. Otherwise set to NULL. |
params | Pointer to a pointer which will have memory allocated and into which a string containing the datum parameters (if present) will be placed. Otherwise set to NULL. |
Definition at line 173 of file proj/datum.c.
References G_asprintf(), G_find_key_value(), G_gisbase(), G_store(), forms::gisbase, and NULL.
Referenced by GPJ_get_datum_params(), GPJ_grass_to_osr(), GPJ_osr_to_grass(), and pj_get_kv().
int GPJ_ask_datum_params | ( | const char * | datumname, |
char ** | params | ||
) |
Interactively ask for datum parameters for a particular datum.
Uses traditional GRASS interactive prompt interface to provide information to user and encourage him/her to select the most appropriate set of datum transformation parameters for the location. Could really benefit from an abstracted user interaction library for seamless GUI interaction.
datumname | String containing datum name that parameters are to be found for. Must exist in datum.table or be "custom" |
params | Pointer to a pointer that will have memory allocated and into which a string containing the datum parameters chosen by the user will be placed. |
Definition at line 239 of file proj/datum.c.
References buff, fclose(), G_asprintf(), G_convert_dirseps_to_host(), G_free(), G_gets(), G_strcasecmp(), G_strip(), G_system(), G_tempfile(), G_warning(), G_yes(), getenv(), GPJ_get_datum_transform_by_name(), NULL, old, and sprintf().
void GPJ_free_datum | ( | struct gpj_datum * | dstruct | ) |
Free the memory used for the strings in a gpj_datum struct.
dstruct | gpj_datum struct to be freed |
Definition at line 543 of file proj/datum.c.
References G_free().
Referenced by GPJ__get_ellipsoid_params(), GPJ_get_datum_transform_by_name(), GPJ_grass_to_osr(), and GPJ_osr_to_grass().
void GPJ_free_datum_transform | ( | struct gpj_datum_transform_list * | item | ) |
Free the memory used by a gpj_datum_transform_list struct.
item | gpj_datum_transform_list struct to be freed |
Definition at line 466 of file proj/datum.c.
References G_free().
Referenced by GPJ_get_default_datum_params_by_name().
int GPJ_get_datum_by_name | ( | const char * | name, |
struct gpj_datum * | dstruct | ||
) |
Look up a string in datum.table file to see if it is a valid datum name and if so place its information into a gpj_datum struct.
name | String containing datum name to look up |
dstruct | gpj_datum struct into which datum parameters will be placed if found |
Definition at line 37 of file proj/datum.c.
References datum_list::dx, datum_list::dy, datum_list::dz, datum_list::ellps, free_datum_list(), G_store(), G_strcasecmp(), datum_list::longname, datum_list::name, datum_list::next, NULL, and read_datum_table().
Referenced by GPJ__get_ellipsoid_params(), GPJ_get_datum_transform_by_name(), GPJ_grass_to_osr(), and GPJ_osr_to_grass().
int GPJ_get_datum_params | ( | char ** | name, |
char ** | params | ||
) |
Extract the datum transformation-related parameters for the current location.
This function can be used to test if a location's co-ordinate system set-up supports datum transformation.
name | Pointer to a pointer which will have memory allocated and into which a string containing the datum name (if present) will be placed. Otherwise set to NULL. |
params | Pointer to a pointer which will have memory allocated and into which a string containing the datum parameters (if present) will be placed. Otherwise set to NULL. |
Definition at line 135 of file proj/datum.c.
References G_free_key_value(), G_get_projinfo(), and GPJ__get_datum_params().
struct gpj_datum_transform_list* GPJ_get_datum_transform_by_name | ( | const char * | inputname | ) |
Internal function to find all possible sets of transformation parameters for a particular datum.
inputname | String containing the datum name we are going to look up parameters for |
Definition at line 377 of file proj/datum.c.
References buf, count, fclose(), fd, file, G_asprintf(), G_getl2(), G_gisbase(), G_store(), G_strcasecmp(), G_strip(), G_warning(), GPJ_free_datum(), GPJ_get_datum_by_name(), render::name, NULL, and sprintf().
Referenced by GPJ_ask_datum_params(), GPJ_get_default_datum_params_by_name(), and GPJ_osr_to_grass().
int GPJ_get_default_datum_params_by_name | ( | const char * | name, |
char ** | params | ||
) |
"Last resort" function to retrieve a "default" set of datum parameters for a datum (N.B. there really is no such thing as a catch-all default!)
Kind of a "last resort" function as there really is no such thing as a default set of datum transformation parameters. Only should really be used where user interaction to choose a set of parameters is not desirable. Use of this function is not likely to result in selection of the optimum set of datum transformation parameters for the location
name | String containing GRASS datum name for which default parameters are to be retrieved |
params | Pointer to a pointer which will have memory allocated and into which a string containing the datum parameters (if present) will be placed |
Definition at line 85 of file proj/datum.c.
References count, G_store(), GPJ_free_datum_transform(), GPJ_get_datum_transform_by_name(), NULL, and old.
Referenced by GPJ_osr_to_grass(), and pj_get_kv().
struct datum_list* read_datum_table | ( | void | ) |
Read the current GRASS datum.table from disk and store in memory.
The datum information is stored in a datum_list linked list structure.
Definition at line 485 of file proj/datum.c.
References buf, count, DATUMTABLE, datum_list::dx, datum_list::dy, datum_list::dz, datum_list::ellps, fclose(), fd, file, G_getl2(), G_gisbase(), G_store(), G_strip(), G_warning(), datum_list::longname, datum_list::name, render::name, datum_list::next, NULL, read_datum_table(), and sprintf().
Referenced by GPJ_get_datum_by_name(), GPJ_osr_to_grass(), and read_datum_table().