|
@@ -443,35 +443,41 @@ int GPJ_init_transform(const struct pj_info *info_in,
|
|
|
G_debug(1, "source proj string: %s", info_in->def);
|
|
|
G_debug(1, "source type: %s", get_pj_type_string(info_in->pj));
|
|
|
indefcrs = info_in->def;
|
|
|
- source_crs = proj_get_source_crs(NULL, info_in->pj);
|
|
|
- if (source_crs) {
|
|
|
- const char *projstr;
|
|
|
|
|
|
- projstr = proj_as_proj_string(NULL, source_crs, PJ_PROJ_5, NULL);
|
|
|
- if (projstr) {
|
|
|
- indefcrs = G_store(projstr);
|
|
|
- G_debug(1, "Input CRS definition converted from '%s' to '%s'",
|
|
|
- info_in->def, indefcrs);
|
|
|
+ if (proj_get_type(info_in->pj) == PJ_TYPE_BOUND_CRS) {
|
|
|
+ source_crs = proj_get_source_crs(NULL, info_in->pj);
|
|
|
+ if (source_crs) {
|
|
|
+ const char *projstr;
|
|
|
+
|
|
|
+ projstr = proj_as_proj_string(NULL, source_crs, PJ_PROJ_5, NULL);
|
|
|
+ if (projstr) {
|
|
|
+ indefcrs = G_store(projstr);
|
|
|
+ G_debug(1, "Input CRS definition converted from '%s' to '%s'",
|
|
|
+ info_in->def, indefcrs);
|
|
|
+ }
|
|
|
+ proj_destroy(source_crs);
|
|
|
+ source_crs = NULL;
|
|
|
}
|
|
|
- proj_destroy(source_crs);
|
|
|
- source_crs = NULL;
|
|
|
}
|
|
|
|
|
|
G_debug(1, "target proj string: %s", info_out->def);
|
|
|
G_debug(1, "target type: %s", get_pj_type_string(info_out->pj));
|
|
|
outdefcrs = info_out->def;
|
|
|
- target_crs = proj_get_source_crs(NULL, info_out->pj);
|
|
|
- if (target_crs) {
|
|
|
- const char *projstr;
|
|
|
|
|
|
- projstr = proj_as_proj_string(NULL, target_crs, PJ_PROJ_5, NULL);
|
|
|
- if (projstr) {
|
|
|
- outdefcrs = G_store(projstr);
|
|
|
- G_debug(1, "Output CRS definition converted from '%s' to '%s'",
|
|
|
- info_out->def, outdefcrs);
|
|
|
+ if (proj_get_type(info_in->pj) == PJ_TYPE_BOUND_CRS) {
|
|
|
+ target_crs = proj_get_source_crs(NULL, info_out->pj);
|
|
|
+ if (target_crs) {
|
|
|
+ const char *projstr;
|
|
|
+
|
|
|
+ projstr = proj_as_proj_string(NULL, target_crs, PJ_PROJ_5, NULL);
|
|
|
+ if (projstr) {
|
|
|
+ outdefcrs = G_store(projstr);
|
|
|
+ G_debug(1, "Output CRS definition converted from '%s' to '%s'",
|
|
|
+ info_out->def, outdefcrs);
|
|
|
+ }
|
|
|
+ proj_destroy(target_crs);
|
|
|
+ target_crs = NULL;
|
|
|
}
|
|
|
- proj_destroy(target_crs);
|
|
|
- target_crs = NULL;
|
|
|
}
|
|
|
|
|
|
/* PROJ6+: EPSG must be uppercase EPSG */
|
|
@@ -680,11 +686,18 @@ int GPJ_init_transform(const struct pj_info *info_in,
|
|
|
info_trans->def);
|
|
|
}
|
|
|
else {
|
|
|
- proj_destroy(info_trans->pj);
|
|
|
- info_trans->pj = pj_norm;
|
|
|
- projstr = proj_as_proj_string(NULL, info_trans->pj,
|
|
|
- PJ_PROJ_5, NULL);
|
|
|
- info_trans->def = G_store(projstr);
|
|
|
+ projstr = proj_as_proj_string(NULL, pj_norm,
|
|
|
+ PJ_PROJ_5, NULL);
|
|
|
+ if (projstr && *projstr) {
|
|
|
+ proj_destroy(info_trans->pj);
|
|
|
+ info_trans->pj = pj_norm;
|
|
|
+ info_trans->def = G_store(projstr);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ proj_destroy(pj_norm);
|
|
|
+ G_warning(_("No PROJ definition for normalized version of '%s'"),
|
|
|
+ info_trans->def);
|
|
|
+ }
|
|
|
}
|
|
|
if (op_count > 1) {
|
|
|
G_important_message(_("Selected pipeline:"));
|
|
@@ -719,6 +732,7 @@ int GPJ_init_transform(const struct pj_info *info_in,
|
|
|
indef, outdef);
|
|
|
|
|
|
info_trans->pj = proj_create(PJ_DEFAULT_CTX, info_trans->def);
|
|
|
+ G_debug(1, "proj_create() pipeline: %s", info_trans->def);
|
|
|
}
|
|
|
|
|
|
if (pj_area)
|