proj2.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_LL:
  31. return U_DEGREES;
  32. default:
  33. return U_UNDEFINED;
  34. }
  35. return U_UNDEFINED;
  36. }
  37. /*!
  38. \brief Get projection name
  39. \param n projection code
  40. \return projection name
  41. \return NULL on error
  42. */
  43. const char *G_projection_name(int n)
  44. {
  45. switch (n) {
  46. case PROJECTION_XY:
  47. return "x,y";
  48. case PROJECTION_UTM:
  49. return "UTM";
  50. case PROJECTION_LL:
  51. return _("Latitude-Longitude");
  52. case PROJECTION_OTHER:
  53. return _("Other Projection");
  54. default:
  55. return NULL;
  56. }
  57. }