Jelajahi Sumber

WIP PROJ6 support (#118)

PROJ6 support

- Convert lowercase epsg to uppercase EPSG
- Axis order of a CRS is no longer always easting, northing, it can also be northing, easting, e.g. EPSG:4326. If source and target CRS are available, axis order is adjusted using proj_normalize_for_visualization() to easting, northing if needed.
- Previously, GRASS did conversions of degress to/from radians and meters from/to map units. Now PROJ6+ might do these conversions itself, or not. GRASS is now doing the conversions only if needed.
- In PROJ6+, there can be several different operations to transform coordinates from one CRS to another CRS. If more than one operation is available, information is provided about these different operations. The current region is used by PROJ to select an appropriate operation.
Markus Metz 5 tahun lalu
induk
melakukan
b32d8be38d
2 mengubah file dengan 852 tambahan dan 68 penghapusan
  1. 840 68
      lib/proj/do_proj.c
  2. 12 0
      lib/proj/get_proj.c

File diff ditekan karena terlalu besar
+ 840 - 68
lib/proj/do_proj.c


+ 12 - 0
lib/proj/get_proj.c

@@ -241,6 +241,12 @@ int pj_get_kv(struct pj_info *info, const struct Key_Value *in_proj_keys,
     G_free(datum);
 
 #ifdef HAVE_PROJ_H
+#if PROJ_VERSION_MAJOR >= 6
+    /* without type=crs, PROJ6 does not recognize what this is, 
+     * a crs or some kind of coordinate operation, falling through to
+     * PJ_TYPE_OTHER_COORDINATE_OPERATION */
+    alloc_options("type=crs");
+#endif
     pjc = proj_context_create();
     if (!(pj = proj_create_argv(pjc, nopt, opt_in))) {
 #else
@@ -398,6 +404,12 @@ int pj_get_string(struct pj_info *info, char *str)
     }
 
 #ifdef HAVE_PROJ_H
+#if PROJ_VERSION_MAJOR >= 6
+    /* without type=crs, PROJ6 does not recognize what this is, 
+     * a crs or some kind of coordinate operation, falling through to
+     * PJ_TYPE_OTHER_COORDINATE_OPERATION */
+    alloc_options("type=crs");
+#endif
     pjc = proj_context_create();
     if (!(pj = proj_create_argv(pjc, nopt, opt_in))) {
 	G_warning(_("Unable to initialize pj cause: %s"),