proj2.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*!
  2. \file gis/proj2.c
  3. \brief GIS Library - Projection support (internal subroutines)
  4. (C) 2001-2010 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
  13. \param n projection code
  14. \return units code
  15. \return -1 if not defined
  16. */
  17. int G__projection_units(int n)
  18. {
  19. switch (n) {
  20. case PROJECTION_XY:
  21. return U_UNKNOWN;
  22. case PROJECTION_UTM:
  23. return U_METERS;
  24. case PROJECTION_SP:
  25. return U_FEET;
  26. case PROJECTION_LL:
  27. return U_DEGREES;
  28. default:
  29. return -1;
  30. }
  31. }
  32. /*!
  33. \brief Get projection name
  34. \param n projection code
  35. \return projection name
  36. \return NULL on error
  37. */
  38. const char *G__projection_name(int n)
  39. {
  40. switch (n) {
  41. case PROJECTION_XY:
  42. return "x,y";
  43. case PROJECTION_UTM:
  44. return "UTM";
  45. case PROJECTION_SP:
  46. return _("State Plane");
  47. case PROJECTION_LL:
  48. return _("Latitude-Longitude");
  49. case PROJECTION_OTHER:
  50. return _("Other Projection");
  51. default:
  52. return NULL;
  53. }
  54. }