gprojects.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. char *srid;
  51. };
  52. struct gpj_datum
  53. {
  54. char *name, *longname, *ellps;
  55. double dx, dy, dz;
  56. };
  57. struct gpj_datum_transform_list
  58. {
  59. int count; /**< Transform Number (ordered list) */
  60. char *params; /**< PROJ.4-style datum transform parameters */
  61. char *where_used; /**< Comment text describing where (geographically)
  62. * the transform is valid */
  63. char *comment; /**< Additional Comments */
  64. struct gpj_datum_transform_list *next; /**< Pointer to next set of
  65. * transform parameters in linked list */
  66. };
  67. struct gpj_ellps
  68. {
  69. char *name, *longname;
  70. double a, es, rf;
  71. };
  72. #ifndef HAVE_PROJ_H
  73. /* PROJ.4's private datastructures copied from projects.h as removed
  74. from upstream; pending better solution. see:
  75. http://trac.osgeo.org/proj/ticket/98 */
  76. /* In PROJ 5, the 'struct FACTORS' is back in as 'struct P5_FACTORS',
  77. * and old 'struct LP' is now back in as 'PJ_UV' */
  78. typedef struct { double u, v; } LP;
  79. struct DERIVS {
  80. double x_l, x_p; /* derivatives of x for lambda-phi */
  81. double y_l, y_p; /* derivatives of y for lambda-phi */
  82. };
  83. struct FACTORS {
  84. struct DERIVS der;
  85. double h, k; /* meridinal, parallel scales */
  86. double omega, thetap; /* angular distortion, theta prime */
  87. double conv; /* convergence */
  88. double s; /* areal scale factor */
  89. double a, b; /* max-min scale error */
  90. int code; /* info as to analytics, see following */
  91. };
  92. /* end of copy */
  93. #endif
  94. #include <grass/defs/gprojects.h>
  95. #endif