GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
defs/gprojects.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int GPJ_init_transform (const struct pj_info *, const struct pj_info *, struct pj_info *)
 Create a PROJ transformation object to transform coordinates from an input SRS to an output SRS. More...
 
int GPJ_transform (const struct pj_info *, const struct pj_info *, const struct pj_info *, int, double *, double *, double *)
 Re-project a point between two co-ordinate systems using a transformation object prepared with GPJ_prepare_pj() More...
 
int GPJ_transform_array (const struct pj_info *, const struct pj_info *, const struct pj_info *, int, double *, double *, double *, int)
 Re-project an array of points between two co-ordinate systems using a transformation object prepared with GPJ_prepare_pj() More...
 
int pj_do_proj (double *, double *, const struct pj_info *, const struct pj_info *)
 Re-project a point between two co-ordinate systems. More...
 
int pj_do_transform (int, double *, double *, double *, const struct pj_info *, const struct pj_info *)
 Re-project an array of points between two co-ordinate systems with optional ellipsoidal height conversion. More...
 
int pj_get_kv (struct pj_info *, const struct Key_Value *, const struct Key_Value *)
 Create a pj_info struct Co-ordinate System definition from a set of PROJ_INFO / PROJ_UNITS-style key-value pairs. More...
 
int pj_get_string (struct pj_info *, char *)
 Create a pj_info struct Co-ordinate System definition from a string with a sequence of key=value pairs. More...
 
int GPJ_get_equivalent_latlong (struct pj_info *, struct pj_info *)
 
const char * set_proj_share (const char *)
 
int pj_print_proj_params (const struct pj_info *, const struct pj_info *)
 Print projection parameters as used by PROJ.4 for input and output co-ordinate systems. More...
 
char * GPJ_grass_to_wkt (const struct Key_Value *, const struct Key_Value *, int, int)
 Converts a GRASS co-ordinate system representation to WKT style. More...
 
char * GPJ_grass_to_wkt2 (const struct Key_Value *, const struct Key_Value *, const struct Key_Value *, int, int)
 Converts a GRASS co-ordinate system representation to WKT style. EPSG code is preferred if available. More...
 
OGRSpatialReferenceH GPJ_grass_to_osr (const struct Key_Value *, const struct Key_Value *)
 Converts a GRASS co-ordinate system to an OGRSpatialReferenceH object. More...
 
OGRSpatialReferenceH GPJ_grass_to_osr2 (const struct Key_Value *, const struct Key_Value *, const struct Key_Value *)
 Converts a GRASS co-ordinate system to an OGRSpatialReferenceH object. EPSG code is preferred if available. More...
 
const char * GPJ_set_csv_loc (const char *)
 
int GPJ_osr_to_grass (struct Cell_head *, struct Key_Value **, struct Key_Value **, OGRSpatialReferenceH, int)
 Converts an OGRSpatialReferenceH object to a GRASS co-ordinate system. More...
 
int GPJ_wkt_to_grass (struct Cell_head *, struct Key_Value **, struct Key_Value **, const char *, int)
 Converts a WKT projection description to a GRASS co-ordinate system. More...
 
int GPJ_get_datum_by_name (const char *, struct gpj_datum *)
 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 *, char **)
 "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 **, char **)
 Extract the datum transformation-related parameters for the current location. More...
 
int GPJ__get_datum_params (const struct Key_Value *, char **, char **)
 Extract the datum transformation-related parameters from a set of general PROJ_INFO parameters. More...
 
void GPJ_free_datum (struct gpj_datum *)
 Free the memory used for the strings in a gpj_datum struct. More...
 
struct gpj_datum_transform_listGPJ_get_datum_transform_by_name (const char *)
 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 *)
 Free the memory used by a gpj_datum_transform_list struct. More...
 
int GPJ_get_ellipsoid_by_name (const char *, struct gpj_ellps *)
 Looks up ellipsoid in ellipsoid table and returns the a, e2 parameters for the ellipsoid. More...
 
int GPJ_get_ellipsoid_params (double *, double *, double *)
 Get the ellipsoid parameters from the database. More...
 
int GPJ__get_ellipsoid_params (const struct Key_Value *, double *, double *, double *)
 Get the ellipsoid parameters from proj keys structure. More...
 
void GPJ_free_ellps (struct gpj_ellps *)
 Free ellipsoid data structure. More...
 
int pj_factors (LP, void *, double, struct FACTORS *)
 

Function Documentation

◆ GPJ__get_datum_params()

int GPJ__get_datum_params ( const 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.

Parameters
projinfoSet of key_value pairs containing projection information in PROJ_INFO file format
datumnamePointer 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.
paramsPointer 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.
Returns
-1 error or no datum information found, 1 only datum name found, 2 params found

Definition at line 173 of file proj/datum.c.

References G_asprintf(), G_debug(), G_find_key_value(), G_store(), and NULL.

Referenced by GPJ_get_datum_params(), and GPJ_osr_to_grass().

◆ GPJ__get_ellipsoid_params()

int GPJ__get_ellipsoid_params ( const struct Key_Value proj_keys,
double *  a,
double *  e2,
double *  rf 
)

Get the ellipsoid parameters from proj keys structure.

If the PROJECTION_FILE exists in the PERMANENT mapset, read info from that file, otherwise return WGS 84 values.

Dies with diagnostic if there is an error.

Parameters
proj_keysproj definition
[out]asemi-major axis
[out]e2first eccentricity squared
[out]rfreciprocal of the ellipsoid flattening term
Returns
1 on success
0 default values used.

Definition at line 74 of file ellipse.c.

◆ GPJ_free_datum()

void GPJ_free_datum ( struct gpj_datum dstruct)

Free the memory used for the strings in a gpj_datum struct.

Parameters
dstructgpj_datum struct to be freed

Definition at line 396 of file proj/datum.c.

References gpj_datum::ellps, G_free(), gpj_datum::longname, and gpj_datum::name.

◆ GPJ_free_datum_transform()

void GPJ_free_datum_transform ( struct gpj_datum_transform_list item)

Free the memory used by a gpj_datum_transform_list struct.

Parameters
itemgpj_datum_transform_list struct to be freed

Definition at line 323 of file proj/datum.c.

References gpj_datum_transform_list::comment, G_free(), gpj_datum_transform_list::params, and gpj_datum_transform_list::where_used.

Referenced by GPJ_get_default_datum_params_by_name().

◆ GPJ_free_ellps()

void GPJ_free_ellps ( struct gpj_ellps estruct)

Free ellipsoid data structure.

Parameters
estructdata structure to be freed

Definition at line 303 of file ellipse.c.

References G_free(), gpj_ellps::longname, and gpj_ellps::name.

◆ GPJ_get_datum_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.

Parameters
nameString containing datum name to look up
dstructgpj_datum struct into which datum parameters will be placed if found
Returns
1 if datum found, -1 if not

Definition at line 38 of file proj/datum.c.

References gpj_datum::dx, gpj_datum::dy, gpj_datum::dz, gpj_datum::ellps, free_datum_list(), G_store(), G_strcasecmp(), list, gpj_datum::longname, gpj_datum::name, name, NULL, and read_datum_table().

◆ GPJ_get_datum_params()

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.

Parameters
namePointer 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.
paramsPointer 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.
Returns
-1 error or no datum information found, 1 only datum name found, 2 params found

Definition at line 135 of file proj/datum.c.

References G_free_key_value(), G_get_projinfo(), GPJ__get_datum_params(), and name.

◆ GPJ_get_datum_transform_by_name()

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.

Parameters
inputnameString containing the datum name we are going to look up parameters for
Returns
Pointer to struct gpj_datum_transform_list (a linked list containing transformation parameters), or NULL if no suitable parameters were found.

Definition at line 237 of file proj/datum.c.

References file, and GPATH_MAX.

Referenced by GPJ_get_default_datum_params_by_name().

◆ GPJ_get_default_datum_params_by_name()

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

Parameters
nameString containing GRASS datum name for which default parameters are to be retrieved
paramsPointer to a pointer which will have memory allocated and into which a string containing the datum parameters (if present) will be placed
Returns
The number of possible parameter sets GRASS knows about for this datum

Definition at line 86 of file proj/datum.c.

References count, G_store(), GPJ_free_datum_transform(), GPJ_get_datum_transform_by_name(), list, name, NULL, and gpj_datum_transform_list::params.

◆ GPJ_get_ellipsoid_by_name()

int GPJ_get_ellipsoid_by_name ( const char *  name,
struct gpj_ellps estruct 
)

Looks up ellipsoid in ellipsoid table and returns the a, e2 parameters for the ellipsoid.

Parameters
nameellipsoid name
[out]estructellipsoid
Returns
1 on success
-1 if not found in table

Definition at line 160 of file ellipse.c.

References gpj_ellps::a, gpj_ellps::es, free_ellps_list(), G_store(), G_strcasecmp(), list, gpj_ellps::longname, gpj_ellps::name, name, NULL, read_ellipsoid_table(), and gpj_ellps::rf.

◆ GPJ_get_ellipsoid_params()

int GPJ_get_ellipsoid_params ( double *  a,
double *  e2,
double *  rf 
)

Get the ellipsoid parameters from the database.

If the PROJECTION_FILE exists in the PERMANENT mapset, read info from that file, otherwise return WGS 84 values.

Dies with diagnostic if there is an error.

Parameters
[out]asemi-major axis
[out]e2first eccentricity squared
[out]rfreciprocal of the ellipsoid flattening term
Returns
1 on success
0 default values used.

Definition at line 44 of file ellipse.c.

◆ GPJ_get_equivalent_latlong()

int GPJ_get_equivalent_latlong ( struct pj_info ,
struct pj_info  
)

◆ GPJ_grass_to_osr()

OGRSpatialReferenceH GPJ_grass_to_osr ( const struct Key_Value proj_info,
const struct Key_Value proj_units 
)

Converts a GRASS co-ordinate system to an OGRSpatialReferenceH object.

Parameters
proj_infoSet of GRASS PROJ_INFO key/value pairs
proj_unitsSet of GRASS PROJ_UNIT key/value pairs
Returns
OGRSpatialReferenceH object representing the co-ordinate system defined by proj_info and proj_units or NULL if it fails

Definition at line 168 of file convert.c.

◆ GPJ_grass_to_osr2()

OGRSpatialReferenceH GPJ_grass_to_osr2 ( const struct Key_Value proj_info,
const struct Key_Value proj_units,
const struct Key_Value proj_epsg 
)

Converts a GRASS co-ordinate system to an OGRSpatialReferenceH object. EPSG code is preferred if available.

The co-ordinate system definition is imported from EPSG (by GDAL) definition if available. TOWGS84 parameter is scanned from PROJ_INFO file and appended to co-ordinate system definition. If EPSG code is not available, PROJ_INFO file is used as GPJ_grass_to_osr() does.

Todo:
Merge with GPJ_grass_to_osr() in GRASS 8.
Parameters
proj_infoSet of GRASS PROJ_INFO key/value pairs
proj_unitsSet of GRASS PROJ_UNIT key/value pairs
proj_epsgSet of GRASS PROJ_EPSG key/value pairs
Returns
OGRSpatialReferenceH object representing the co-ordinate system defined by proj_info and proj_units or NULL if it fails

Definition at line 359 of file convert.c.

◆ GPJ_grass_to_wkt()

char* GPJ_grass_to_wkt ( const struct Key_Value proj_info,
const struct Key_Value proj_units,
int  esri_style,
int  prettify 
)

Converts a GRASS co-ordinate system representation to WKT style.

Takes a GRASS co-ordinate system as specified by two sets of key/value pairs derived from the PROJ_INFO and PROJ_UNITS files, and converts it to the 'Well Known Text' format.

Parameters
proj_infoSet of GRASS PROJ_INFO key/value pairs
proj_unitsSet of GRASS PROJ_UNIT key/value pairs
esri_styleboolean Output ESRI-style WKT (Use OSRMorphToESRI() function provided by OGR library)
prettifyboolean Use linebreaks and indents to 'prettify' output WKT string (Use OSRExportToPrettyWkt() function in OGR)
Returns
Pointer to a string containing the co-ordinate system in WKT format
NULL on error

Definition at line 119 of file convert.c.

◆ GPJ_grass_to_wkt2()

char* GPJ_grass_to_wkt2 ( const struct Key_Value proj_info,
const struct Key_Value proj_units,
const struct Key_Value proj_epsg,
int  esri_style,
int  prettify 
)

Converts a GRASS co-ordinate system representation to WKT style. EPSG code is preferred if available.

Takes a GRASS co-ordinate system as specified key/value pairs derived from the PROJ_EPSG file. TOWGS84 parameter is scanned from PROJ_INFO file and appended to co-ordinate system definition imported from EPSG code by GDAL library. PROJ_UNITS file is ignored. The function converts it to the 'Well Known Text' format.

Todo:
Merge with GPJ_grass_to_wkt() in GRASS 8.
Parameters
proj_infoSet of GRASS PROJ_INFO key/value pairs
proj_unitsSet of GRASS PROJ_UNIT key/value pairs
proj_epsgSet of GRASS PROJ_EPSG key/value pairs
esri_styleboolean Output ESRI-style WKT (Use OSRMorphToESRI() function provided by OGR library)
prettifyboolean Use linebreaks and indents to 'prettify' output WKT string (Use OSRExportToPrettyWkt() function in OGR)
Returns
Pointer to a string containing the co-ordinate system in WKT format
NULL on error

Definition at line 150 of file convert.c.

◆ GPJ_init_transform()

int GPJ_init_transform ( const struct pj_info info_in,
const struct pj_info info_out,
struct pj_info info_trans 
)

Create a PROJ transformation object to transform coordinates from an input SRS to an output SRS.

After the transformation has been initialized with this function, coordinates can be transformed from input SRS to output SRS with GPJ_transform() and direction = PJ_FWD, and back from output SRS to input SRS with direction = OJ_INV. If coordinates should be transformed between the input SRS and its latlong equivalent, an uninitialized info_out with info_out->pj = NULL can be passed to the function. In this case, coordinates will be transformed between the input SRS and its latlong equivalent, and for PROJ 5+, the transformation object is created accordingly, while for PROJ 4, the output SRS is created as latlong equivalent of the input SRS

PROJ 5+: info_in->pj must not be null if info_out->pj is null, assume info_out to be the ll equivalent of info_in create info_trans as conversion from info_in to its ll equivalent NOTE: this is the inverse of the logic of PROJ 5 which by default 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 else do nothing, info_trans is not used

Parameters
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
info_transpointer to pj_info struct for a transformation object (PROJ 5+)
Returns
1 on success, -1 on failure

Definition at line 434 of file do_proj.c.

References _, pj_info::def, G_asprintf(), G_debug(), G_fatal_error(), G_free(), G_important_message(), G_store(), G_store_upper(), G_warning(), pj_info::meters, NULL, pj_info::pj, pj_info::proj, pj_info::srid, and pj_info::zone.

◆ GPJ_osr_to_grass()

int GPJ_osr_to_grass ( struct Cell_head cellhd,
struct Key_Value **  projinfo,
struct Key_Value **  projunits,
OGRSpatialReferenceH  hSRS1,
int  datumtrans 
)

Converts an OGRSpatialReferenceH object to a GRASS co-ordinate system.

Parameters
cellhdPointer to a GRASS Cell_head structure that will have its projection-related members populated with appropriate values
projinfoPointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_INFO values
projunitsPointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_UNITS values
hSRSOGRSpatialReferenceH object containing the co-ordinate system to be converted
datumtransIndex number of datum parameter set to use, 0 to leave unspecified
Returns
2 if a projected or lat/long co-ordinate system has been defined
1 if an unreferenced XY co-ordinate system has been defined

Definition at line 421 of file convert.c.

References _, G_create_key_value(), G_debug(), G_find_key_value(), G_free(), G_gisbase(), G_lookup_key_value_from_file(), G_set_key_value(), G_store(), G_strcasecmp(), G_warning(), GPJ__get_datum_params(), list, name, NULL, Cell_head::proj, PROJECTION_LL, PROJECTION_OTHER, PROJECTION_UTM, and Cell_head::zone.

Referenced by GPJ_wkt_to_grass().

◆ GPJ_set_csv_loc()

const char* GPJ_set_csv_loc ( const char *  name)

Definition at line 1010 of file convert.c.

References CSVDIR, G_asprintf(), G_free(), G_gisbase(), name, and NULL.

◆ GPJ_transform()

int GPJ_transform ( const struct pj_info info_in,
const struct pj_info info_out,
const struct pj_info info_trans,
int  dir,
double *  x,
double *  y,
double *  z 
)

Re-project a point between two co-ordinate systems using a transformation object prepared with GPJ_prepare_pj()

This function takes pointers to three pj_info structures as arguments, and projects a point between the input and output co-ordinate system. The pj_info structure info_trans must have been initialized with GPJ_init_transform(). The direction determines if a point is projected from input CRS to output CRS (PJ_FWD) or from output CRS to input CRS (PJ_INV). The easting, northing, and height of the point are contained in the pointers passed to the function; these will be overwritten by the coordinates of the transformed point.

Parameters
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
info_transpointer to pj_info struct for a transformation object (PROJ 5+)
dirdirection of the transformation (PJ_FWD or PJ_INV)
xPointer to a double containing easting or longitude
yPointer to a double containing northing or latitude
zPointer to a double containing height, or NULL
Returns
Return value from PROJ proj_trans() function

Definition at line 1008 of file do_proj.c.

◆ GPJ_transform_array()

int GPJ_transform_array ( const struct pj_info info_in,
const struct pj_info info_out,
const struct pj_info info_trans,
int  dir,
double *  x,
double *  y,
double *  z,
int  n 
)

Re-project an array of points between two co-ordinate systems using a transformation object prepared with GPJ_prepare_pj()

This function takes pointers to three pj_info structures as arguments, and projects an array of pointd between the input and output co-ordinate system. The pj_info structure info_trans must have been initialized with GPJ_init_transform(). The direction determines if a point is projected from input CRS to output CRS (PJ_FWD) or from output CRS to input CRS (PJ_INV). The easting, northing, and height of the point are contained in the pointers passed to the function; these will be overwritten by the coordinates of the transformed point.

Parameters
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
info_transpointer to pj_info struct for a transformation object (PROJ 5+)
dirdirection of the transformation (PJ_FWD or PJ_INV)
xpointer to an array of type double containing easting or longitude
ypointer to an array of type double containing northing or latitude
zpointer to an array of type double containing height, or NULL
nnumber of points in the arrays to be transformed
Returns
Return value from PROJ proj_trans() function

Definition at line 1227 of file do_proj.c.

◆ GPJ_wkt_to_grass()

int GPJ_wkt_to_grass ( struct Cell_head cellhd,
struct Key_Value **  projinfo,
struct Key_Value **  projunits,
const char *  wkt,
int  datumtrans 
)

Converts a WKT projection description to a GRASS co-ordinate system.

Parameters
cellhdPointer to a GRASS Cell_head structure that will have its projection-related members populated with appropriate values
projinfoPointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_INFO values
projunitsPointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_UNITS values
wktWell-known Text (WKT) description of the co-ordinate system to be converted
datumtransIndex number of datum parameter set to use, 0 to leave unspecified
Returns
2 if a projected or lat/long co-ordinate system has been defined
1 if an unreferenced XY co-ordinate system has been defined
-1 on error

Definition at line 978 of file convert.c.

References GPJ_osr_to_grass(), and NULL.

◆ pj_do_proj()

int pj_do_proj ( double *  x,
double *  y,
const struct pj_info info_in,
const struct pj_info info_out 
)

Re-project a point between two co-ordinate systems.

This function takes pointers to two pj_info structures as arguments, and projects a point between the co-ordinate systems represented by them. The easting and northing of the point are contained in two pointers passed to the function; these will be overwritten by the co-ordinates of the re-projected point.

Parameters
xPointer to a double containing easting or longitude
yPointer to a double containing northing or latitude
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
Returns
Return value from PROJ proj_trans() function

Definition at line 1490 of file do_proj.c.

◆ pj_do_transform()

int pj_do_transform ( int  count,
double *  x,
double *  y,
double *  h,
const struct pj_info info_in,
const struct pj_info info_out 
)

Re-project an array of points between two co-ordinate systems with optional ellipsoidal height conversion.

This function takes pointers to two pj_info structures as arguments, and projects an array of points between the co-ordinate systems represented by them. Pointers to the three arrays of easting, northing, and ellipsoidal height of the point (this one may be NULL) are passed to the function; these will be overwritten by the co-ordinates of the re-projected points.

Parameters
countNumber of points in the arrays to be transformed
xPointer to an array of type double containing easting or longitude
yPointer to an array of type double containing northing or latitude
hPointer to an array of type double containing ellipsoidal height. May be null in which case a two-dimensional re-projection will be done
info_inpointer to pj_info struct for input co-ordinate system
info_outpointer to pj_info struct for output co-ordinate system
Returns
Return value from PROJ proj_trans() function

Definition at line 1620 of file do_proj.c.

◆ pj_factors()

int pj_factors ( LP  ,
void *  ,
double  ,
struct FACTORS *   
)

◆ pj_get_kv()

int pj_get_kv ( struct pj_info info,
const struct Key_Value in_proj_keys,
const struct Key_Value in_units_keys 
)

Create a pj_info struct Co-ordinate System definition from a set of PROJ_INFO / PROJ_UNITS-style key-value pairs.

This function takes a GRASS-style co-ordinate system definition as stored in the PROJ_INFO and PROJ_UNITS files and processes it to create a pj_info representation for use in re-projecting with pj_do_proj(). In addition to the parameters passed to it it may also make reference to the system ellipse.table and datum.table files if necessary.

Parameters
infoPointer to a pj_info struct (which must already exist) into which the co-ordinate system definition will be placed
in_proj_keysPROJ_INFO-style key-value pairs
in_units_keysPROJ_UNITS-style key-value pairs
Returns
-1 on error (unable to initialise PROJ.4) 2 if "default" 3-parameter datum shift values from datum.table were used 3 if an unrecognised datum name was passed on to PROJ.4 (and initialization was successful) 1 otherwise

Definition at line 60 of file get_proj.c.

◆ pj_get_string()

int pj_get_string ( struct pj_info info,
char *  str 
)

Create a pj_info struct Co-ordinate System definition from a string with a sequence of key=value pairs.

This function takes a GRASS- or PROJ style co-ordinate system definition and processes it to create a pj_info representation for use in re-projecting with pj_do_proj(). In addition to the parameters passed to it it may also make reference to the system ellipse.table and datum.table files if necessary.

Parameters
infoPointer to a pj_info struct (which must already exist) into which the co-ordinate system definition will be placed
strinput string with projection definition
in_units_keysPROJ_UNITS-style key-value pairs
Returns
-1 on error (unable to initialise PROJ.4) 1 on success

Definition at line 339 of file get_proj.c.

◆ pj_print_proj_params()

int pj_print_proj_params ( const struct pj_info iproj,
const struct pj_info oproj 
)

Print projection parameters as used by PROJ.4 for input and output co-ordinate systems.

Parameters
iproj'Input' co-ordinate system
oproj'Output' co-ordinate system
Returns
1 on success, -1 on error (i.e. if the PROJ-style definition is NULL for either co-ordinate system)

Definition at line 554 of file get_proj.c.

References _, pj_info::def, pj_info::meters, and NULL.

◆ set_proj_share()

const char* set_proj_share ( const char *  name)

Definition at line 518 of file get_proj.c.

References G_free(), G_malloc, name, and NULL.