gprojects.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 _GPROJECTS_H
  17. #define _GPROJECTS_H
  18. #include <grass/config.h>
  19. #include <proj_api.h>
  20. #ifdef HAVE_OGR
  21. # include <ogr_srs_api.h>
  22. #endif
  23. /* Data Files */
  24. #define ELLIPSOIDTABLE "/etc/ellipse.table"
  25. #define DATUMTABLE "/etc/datum.table"
  26. #define DATUMTRANSFORMTABLE "/etc/datumtransform.table"
  27. /* GRASS relative location of datum conversion lookup tables */
  28. #define GRIDDIR "/etc/nad"
  29. struct pj_info
  30. {
  31. projPJ pj;
  32. double meters;
  33. int zone;
  34. char proj[100];
  35. };
  36. struct gpj_datum
  37. {
  38. char *name, *longname, *ellps;
  39. double dx, dy, dz;
  40. };
  41. struct gpj_datum_transform_list
  42. {
  43. int count; /**< Transform Number (ordered list) */
  44. char *params; /**< PROJ.4-style datum transform parameters */
  45. char *where_used; /**< Comment text describing where (geographically)
  46. * the transform is valid */
  47. char *comment; /**< Additional Comments */
  48. struct gpj_datum_transform_list *next; /**< Pointer to next set of
  49. * transform parameters in linked list */
  50. };
  51. struct gpj_ellps
  52. {
  53. char *name, *longname;
  54. double a, es, rf;
  55. };
  56. /* do_proj.c */
  57. int pj_do_proj(double *, double *, struct pj_info *, struct pj_info *);
  58. int pj_do_transform(int, double *, double *, double *,
  59. struct pj_info *, struct pj_info *);
  60. /* get_proj.c */
  61. int pj_get_kv(struct pj_info *, struct Key_Value *, struct Key_Value *);
  62. int pj_get_string(struct pj_info *, char *);
  63. int GPJ_get_equivalent_latlong(struct pj_info *, struct pj_info *);
  64. const char *set_proj_lib(const char *);
  65. int pj_print_proj_params(struct pj_info *, struct pj_info *);
  66. /* convert.c */
  67. #ifdef HAVE_OGR
  68. char *GPJ_grass_to_wkt(struct Key_Value *, struct Key_Value *, int, int);
  69. OGRSpatialReferenceH GPJ_grass_to_osr(struct Key_Value *, struct Key_Value *);
  70. int GPJ_wkt_to_grass(struct Cell_head *, struct Key_Value **,
  71. struct Key_Value **, const char *, int);
  72. int GPJ_osr_to_grass(struct Cell_head *, struct Key_Value **,
  73. struct Key_Value **, OGRSpatialReferenceH, int);
  74. const char *GPJ_set_csv_loc(const char *);
  75. #endif
  76. /* datum.c */
  77. int GPJ_get_datum_by_name(const char *, struct gpj_datum *);
  78. int GPJ_get_default_datum_params_by_name(const char *, char **);
  79. int GPJ_get_datum_params(char **, char **);
  80. int GPJ__get_datum_params(struct Key_Value *, char **, char **);
  81. void GPJ_free_datum(struct gpj_datum *);
  82. struct gpj_datum_transform_list *GPJ_get_datum_transform_by_name(const char *);
  83. void GPJ_free_datum_transform(struct gpj_datum_transform_list *);
  84. /* ellipse.c */
  85. int GPJ_get_ellipsoid_by_name(const char *, struct gpj_ellps *);
  86. int GPJ_get_ellipsoid_params(double *, double *, double *);
  87. int GPJ__get_ellipsoid_params(struct Key_Value *,
  88. double *, double *, double *);
  89. void GPJ_free_ellps(struct gpj_ellps *);
  90. #endif