GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-602118adcc
proj2.c
Go to the documentation of this file.
1 /*!
2  \file lib/gis/proj2.c
3 
4  \brief GIS Library - Projection support (internal subroutines)
5 
6  (C) 2001-2011 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Original author CERL
12  */
13 
14 #include <grass/gis.h>
15 #include <grass/glocale.h>
16 
17 /*!
18  \brief Get projection units code (for internal use only)
19 
20  \param n projection code
21 
22  Supported units (see gis.h):
23  - U_UNKNOWN (XY)
24  - U_METERS (UTM)
25  - U_FEET (SP)
26  - U_USFEET (a few SP)
27  - U_DEGREES (LL)
28 
29  \return units code (see gis.h)
30  \return U_UNDEFINED if not defined
31  */
33 {
34  switch (n) {
35  case PROJECTION_XY:
36  return U_UNKNOWN;
37  case PROJECTION_UTM:
38  return U_METERS;
39  case PROJECTION_LL:
40  return U_DEGREES;
41  default:
42  return U_UNDEFINED;
43  }
44  return U_UNDEFINED;
45 }
46 
47 /*!
48  \brief Get projection name
49 
50  \param n projection code
51 
52  \return projection name
53  \return NULL on error
54  */
55 const char *G_projection_name(int n)
56 {
57  switch (n) {
58  case PROJECTION_XY:
59  return "x,y";
60  case PROJECTION_UTM:
61  return "UTM";
62  case PROJECTION_LL:
63  return _("Latitude-Longitude");
64  case PROJECTION_OTHER:
65  return _("Other Projection");
66  default:
67  return NULL;
68  }
69 }
#define NULL
Definition: ccmath.h:32
#define PROJECTION_OTHER
Projection code - other projection (other then noted above)
Definition: gis.h:132
#define PROJECTION_XY
Projection code - XY coordinate system (unreferenced data)
Definition: gis.h:124
#define U_UNDEFINED
List of units.
Definition: gis.h:104
#define U_METERS
Definition: gis.h:109
#define U_DEGREES
Definition: gis.h:113
#define PROJECTION_UTM
Projection code - UTM.
Definition: gis.h:126
#define U_UNKNOWN
Definition: gis.h:105
#define PROJECTION_LL
Projection code - Latitude-Longitude.
Definition: gis.h:130
#define _(str)
Definition: glocale.h:10
int G_projection_units(int n)
Get projection units code (for internal use only)
Definition: proj2.c:32
const char * G_projection_name(int n)
Get projection name.
Definition: proj2.c:55