gprojects.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. ******************************************************************************
  3. *
  4. * MODULE: gproj library
  5. * AUTHOR(S): Original Author unknown, probably Soil Conservation Service
  6. * Paul Kelly
  7. * PURPOSE: Include file for GRASS modules that use the PROJ.4
  8. * wrapper functions
  9. * COPYRIGHT: (C) 2003 by the GRASS Development Team
  10. *
  11. * This program is free software under the GNU General Public
  12. * License (>=v2). Read the file COPYING that comes with GRASS
  13. * for details.
  14. *
  15. *****************************************************************************/
  16. #ifndef GRASS_GPROJECTS_H
  17. #define GRASS_GPROJECTS_H
  18. #include <grass/config.h>
  19. /* TODO: clean up support for PROJ 5+ */
  20. #ifdef HAVE_PROJ_H
  21. #include <proj.h>
  22. #define RAD_TO_DEG 57.295779513082321
  23. #define DEG_TO_RAD .017453292519943296
  24. #else
  25. #include <proj_api.h>
  26. #define PJ_FWD 1
  27. #define PJ_INV -1
  28. #endif
  29. #ifdef HAVE_OGR
  30. # include <ogr_srs_api.h>
  31. #endif
  32. /* Data Files */
  33. #define ELLIPSOIDTABLE "/etc/proj/ellipse.table"
  34. #define DATUMTABLE "/etc/proj/datum.table"
  35. #define DATUMTRANSFORMTABLE "/etc/proj/datumtransform.table"
  36. /* GRASS relative location of datum conversion lookup tables */
  37. #define GRIDDIR "/etc/proj/nad"
  38. /* TODO: rename pj_ to gpj_ to avoid symbol clash with PROJ lib */
  39. struct pj_info
  40. {
  41. #ifdef HAVE_PROJ_H
  42. PJ *pj;
  43. #else
  44. projPJ pj;
  45. #endif
  46. double meters;
  47. int zone;
  48. char proj[100];
  49. char *def;
  50. };
  51. struct gpj_datum
  52. {
  53. char *name, *longname, *ellps;
  54. double dx, dy, dz;
  55. };
  56. struct gpj_datum_transform_list
  57. {
  58. int count; /**< Transform Number (ordered list) */
  59. char *params; /**< PROJ.4-style datum transform parameters */
  60. char *where_used; /**< Comment text describing where (geographically)
  61. * the transform is valid */
  62. char *comment; /**< Additional Comments */
  63. struct gpj_datum_transform_list *next; /**< Pointer to next set of
  64. * transform parameters in linked list */
  65. };
  66. struct gpj_ellps
  67. {
  68. char *name, *longname;
  69. double a, es, rf;
  70. };
  71. #ifndef HAVE_PROJ_H
  72. /* PROJ.4's private datastructures copied from projects.h as removed
  73. from upstream; pending better solution. see:
  74. http://trac.osgeo.org/proj/ticket/98 */
  75. /* In PROJ 5, the 'struct FACTORS' is back in as 'struct P5_FACTORS',
  76. * and old 'struct LP' is now back in as 'PJ_UV' */
  77. typedef struct { double u, v; } LP;
  78. struct DERIVS {
  79. double x_l, x_p; /* derivatives of x for lambda-phi */
  80. double y_l, y_p; /* derivatives of y for lambda-phi */
  81. };
  82. struct FACTORS {
  83. struct DERIVS der;
  84. double h, k; /* meridinal, parallel scales */
  85. double omega, thetap; /* angular distortion, theta prime */
  86. double conv; /* convergence */
  87. double s; /* areal scale factor */
  88. double a, b; /* max-min scale error */
  89. int code; /* info as to analytics, see following */
  90. };
  91. /* end of copy */
  92. #endif
  93. #include <grass/defs/gprojects.h>
  94. #endif