|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-5f4f7ad06c
|
GProj Library - Functions for manipulating co-ordinate system representations. More...
#include <grass/config.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <grass/gis.h>#include <grass/gprojects.h>#include <grass/glocale.h>#include <cpl_csv.h>#include "local_proto.h"
Go to the source code of this file.
Macros | |
| #define | CSVDIR "/etc/proj/ogr_csv" |
Functions | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| const char * | GPJ_set_csv_loc (const char *name) |
Variables | |
| struct gpj_units | gpj_units [] |
GProj Library - Functions for manipulating co-ordinate system representations.
(C) 2003-2018 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file convert.c.
| 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.
| proj_info | Set of GRASS PROJ_INFO key/value pairs |
| proj_units | Set of GRASS PROJ_UNIT key/value pairs |
Definition at line 160 of file convert.c.
References _, gpj_ellps::a, gpj_ellps::es, G_asprintf(), G_debug(), G_find_key_value(), G_free(), G_store(), G_strcasecmp(), G_warning(), GPJ__get_datum_params(), GPJ__get_ellipsoid_params(), GPJ_free_datum(), GPJ_free_ellps(), GPJ_get_datum_by_name(), GPJ_get_ellipsoid_by_name(), NULL, pj_get_kv(), gpj_ellps::rf, and pj_info::wkt.
Referenced by 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.
| proj_info | Set of GRASS PROJ_INFO key/value pairs |
| proj_units | Set of GRASS PROJ_UNIT key/value pairs |
| proj_epsg | Set of GRASS PROJ_EPSG key/value pairs |
Definition at line 347 of file convert.c.
References G_find_key_value(), G_free_tokens(), G_number_of_tokens(), G_tokenize(), GPJ_grass_to_osr(), and NULL.
| 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.
| proj_info | Set of GRASS PROJ_INFO key/value pairs |
| proj_units | Set of GRASS PROJ_UNIT key/value pairs |
| esri_style | boolean Output ESRI-style WKT (Use OSRMorphToESRI() function provided by OGR library) |
| prettify | boolean Use linebreaks and indents to 'prettify' output WKT string (Use OSRExportToPrettyWkt() function in OGR) |
Definition at line 112 of file convert.c.
References NULL.
| 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.
| proj_info | Set of GRASS PROJ_INFO key/value pairs |
| proj_units | Set of GRASS PROJ_UNIT key/value pairs |
| proj_epsg | Set of GRASS PROJ_EPSG key/value pairs |
| esri_style | boolean Output ESRI-style WKT (Use OSRMorphToESRI() function provided by OGR library) |
| prettify | boolean Use linebreaks and indents to 'prettify' output WKT string (Use OSRExportToPrettyWkt() function in OGR) |
Definition at line 143 of file convert.c.
Referenced by Rast_create_gdal_link().
| 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.
| cellhd | Pointer to a GRASS Cell_head structure that will have its projection-related members populated with appropriate values |
| projinfo | Pointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_INFO values |
| projunits | Pointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_UNITS values. |
| hSRS1 | OGRSpatialReferenceH object containing the co-ordinate system to be converted |
| datumtrans | Index number of datum parameter set to use, 0 to leave unspecified |
Definition at line 413 of file convert.c.
References _, AMI_STREAM< T >::AMI_STREAM(), gpj_datum_transform_list::count, free_datum_list(), free_ellps_list(), G_asprintf(), G_create_key_value(), G_debug(), G_find_key_value(), G_free(), G_free_key_value(), G_gisbase(), G_lookup_key_value_from_file(), G_malloc, G_set_key_value(), G_store(), G_strcasecmp(), G_warning(), GPJ__get_datum_params(), GPJ__get_ellipsoid_params(), GPJ_free_datum(), GPJ_free_datum_transform(), GPJ_get_datum_by_name(), GPJ_get_datum_transform_by_name(), GPJ_get_default_datum_params_by_name(), gpj_units, name, gpj_datum_transform_list::next, NULL, gpj_datum_transform_list::params, Cell_head::proj, PROJECTION_LL, PROJECTION_OTHER, PROJECTION_UTM, PROJECTION_XY, read_datum_table(), read_ellipsoid_table(), strcpy, and Cell_head::zone.
Referenced by GPJ_wkt_to_grass().
Definition at line 998 of file convert.c.
References UntypedStream::buf, CSVDIR, G_asprintf(), G_free(), G_gisbase(), name, and NULL.
| 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.
| cellhd | Pointer to a GRASS Cell_head structure that will have its projection-related members populated with appropriate values |
| projinfo | Pointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_INFO values |
| projunits | Pointer to a pointer which will have a GRASS Key_Value structure allocated containing a set of GRASS PROJ_UNITS values |
| wkt | Well-known Text (WKT) description of the co-ordinate system to be converted |
| datumtrans | Index number of datum parameter set to use, 0 to leave unspecified |
Definition at line 971 of file convert.c.
References AMI_STREAM< T >::AMI_STREAM(), GPJ_osr_to_grass(), and NULL.
| struct gpj_units gpj_units[] |
Definition at line 41 of file convert.c.
Referenced by GPJ_osr_to_grass().