gprojects.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * $Id$
  3. *
  4. ******************************************************************************
  5. *
  6. * MODULE: gproj library
  7. * AUTHOR(S): Original Author unknown, probably Soil Conservation Service
  8. * Paul Kelly
  9. * PURPOSE: Include file for GRASS modules that use the PROJ.4
  10. * wrapper functions
  11. * COPYRIGHT: (C) 2003 by the GRASS Development Team
  12. *
  13. * This program is free software under the GNU General Public
  14. * License (>=v2). Read the file COPYING that comes with GRASS
  15. * for details.
  16. *
  17. *****************************************************************************/
  18. #ifndef _GPROJECTS_H
  19. #define _GPROJECTS_H
  20. #include <grass/config.h>
  21. #include <proj_api.h>
  22. #ifdef HAVE_OGR
  23. # include <ogr_srs_api.h>
  24. #endif
  25. /* Data Files */
  26. #define ELLIPSOIDTABLE "/etc/ellipse.table"
  27. #define DATUMTABLE "/etc/datum.table"
  28. #define DATUMTRANSFORMTABLE "/etc/datumtransform.table"
  29. /* GRASS relative location of datum conversion lookup tables */
  30. #define GRIDDIR "/etc/nad"
  31. struct pj_info {
  32. projPJ *pj;
  33. double meters;
  34. int zone;
  35. char proj[100];
  36. };
  37. struct gpj_datum
  38. {
  39. char *name, *longname, *ellps;
  40. double dx, dy, dz;
  41. };
  42. struct gpj_datum_transform_list
  43. {
  44. int count; /**< Transform Number (ordered list) */
  45. char *params; /**< PROJ.4-style datum transform parameters */
  46. char *where_used; /**< Comment text describing where (geographically)
  47. * the transform is valid */
  48. char *comment; /**< Additional Comments */
  49. struct gpj_datum_transform_list *next; /**< Pointer to next set of
  50. * transform parameters in linked list */
  51. };
  52. struct gpj_ellps
  53. {
  54. char *name, *longname;
  55. double a, es, rf;
  56. };
  57. /* do_proj.c */
  58. int pj_do_proj (double *, double *, struct pj_info *, struct pj_info *);
  59. int pj_do_transform (int, double *, double *, double *,
  60. struct pj_info *, struct pj_info *);
  61. /* get_proj.c */
  62. int pj_get_kv (struct pj_info *, struct Key_Value *, struct Key_Value *);
  63. int pj_get_string (struct pj_info *, char *);
  64. int GPJ_get_equivalent_latlong (struct pj_info *, struct pj_info *);
  65. const char * set_proj_lib (const char *);
  66. int pj_print_proj_params (struct pj_info *, struct pj_info *);
  67. /* convert.c */
  68. #ifdef HAVE_OGR
  69. char * GPJ_grass_to_wkt (struct Key_Value *, struct Key_Value *, int, int );
  70. OGRSpatialReferenceH GPJ_grass_to_osr (struct Key_Value *, struct Key_Value * );
  71. int GPJ_wkt_to_grass(struct Cell_head *, struct Key_Value **,
  72. struct Key_Value **, const char *, int);
  73. int GPJ_osr_to_grass(struct Cell_head *, struct Key_Value **,
  74. struct Key_Value **, OGRSpatialReferenceH, int);
  75. const char *GPJ_set_csv_loc(const char *);
  76. #endif
  77. /* datum.c */
  78. int GPJ_get_datum_by_name (const char *, struct gpj_datum *);
  79. int GPJ_get_default_datum_params_by_name(const char *, char **);
  80. int GPJ_get_datum_params (char **, char **);
  81. int GPJ__get_datum_params (struct Key_Value *, char **, char **);
  82. void GPJ_free_datum (struct gpj_datum *);
  83. int GPJ_ask_datum_params(const char *, char **);
  84. struct gpj_datum_transform_list *GPJ_get_datum_transform_by_name(const char
  85. *inputname);
  86. /* ellipse.c */
  87. int GPJ_get_ellipsoid_by_name (const char *, struct gpj_ellps *);
  88. int GPJ_get_ellipsoid_params (double *, double *, double *);
  89. int GPJ__get_ellipsoid_params (struct Key_Value *,
  90. double *, double *, double *);
  91. void GPJ_free_ellps (struct gpj_ellps *);
  92. #endif