proj2.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*!
  2. \file lib/gis/proj2.c
  3. \brief GIS Library - Projection support (internal subroutines)
  4. (C) 2001-2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Original author CERL
  8. */
  9. #include <grass/gis.h>
  10. #include <grass/glocale.h>
  11. /*!
  12. \brief Get projection units code (for internal use only)
  13. \param n projection code
  14. Supported units (see gis.h):
  15. - U_UNKNOWN (XY)
  16. - U_METERS (UTM)
  17. - U_FEET (SP)
  18. - U_USFEET (a few SP)
  19. - U_DEGREES (LL)
  20. \return units code (see gis.h)
  21. \return U_UNDEFINED if not defined
  22. */
  23. int G__projection_units(int n)
  24. {
  25. switch (n) {
  26. case PROJECTION_XY:
  27. return U_UNKNOWN;
  28. case PROJECTION_UTM:
  29. return U_METERS;
  30. case PROJECTION_SP:
  31. return U_FEET; /* TODO: what if U_USFEET as in CA and NC ? */
  32. case PROJECTION_LL:
  33. return U_DEGREES;
  34. default:
  35. return U_UNDEFINED;
  36. }
  37. return U_UNDEFINED;
  38. }
  39. /*!
  40. \brief Get projection name
  41. \param n projection code
  42. \return projection name
  43. \return NULL on error
  44. */
  45. const char *G__projection_name(int n)
  46. {
  47. switch (n) {
  48. case PROJECTION_XY:
  49. return "x,y";
  50. case PROJECTION_UTM:
  51. return "UTM";
  52. case PROJECTION_SP:
  53. return _("State Plane");
  54. case PROJECTION_LL:
  55. return _("Latitude-Longitude");
  56. case PROJECTION_OTHER:
  57. return _("Other Projection");
  58. default:
  59. return NULL;
  60. }
  61. }