|
@@ -75,7 +75,8 @@ int main(int argc, char *argv[])
|
|
struct Option *input, *output, *target, *title, *outloc, *band,
|
|
struct Option *input, *output, *target, *title, *outloc, *band,
|
|
*memory, *offset, *rat;
|
|
*memory, *offset, *rat;
|
|
} parm;
|
|
} parm;
|
|
- struct Flag *flag_o, *flag_e, *flag_k, *flag_f, *flag_l, *flag_c, *flag_p;
|
|
|
|
|
|
+ struct Flag *flag_o, *flag_e, *flag_k, *flag_f, *flag_l, *flag_c, *flag_p,
|
|
|
|
+ *flag_j;
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
/* -------------------------------------------------------------------- */
|
|
/* Initialize. */
|
|
/* Initialize. */
|
|
@@ -159,6 +160,13 @@ int main(int argc, char *argv[])
|
|
flag_o->description =
|
|
flag_o->description =
|
|
_("Assume that the dataset has same projection as the current location");
|
|
_("Assume that the dataset has same projection as the current location");
|
|
|
|
|
|
|
|
+ flag_j = G_define_flag();
|
|
|
|
+ flag_j->key = 'j';
|
|
|
|
+ flag_j->description =
|
|
|
|
+ _("Perform projection check only and exit");
|
|
|
|
+ flag_j->suppress_required = YES;
|
|
|
|
+ G_option_requires(flag_j, parm.input, NULL);
|
|
|
|
+
|
|
flag_e = G_define_flag();
|
|
flag_e = G_define_flag();
|
|
flag_e->key = 'e';
|
|
flag_e->key = 'e';
|
|
flag_e->label = _("Extend region extents based on new dataset");
|
|
flag_e->label = _("Extend region extents based on new dataset");
|
|
@@ -191,7 +199,6 @@ int main(int argc, char *argv[])
|
|
flag_p->key = 'p';
|
|
flag_p->key = 'p';
|
|
flag_p->description = _("Print number of bands and exit");
|
|
flag_p->description = _("Print number of bands and exit");
|
|
flag_p->suppress_required = YES;
|
|
flag_p->suppress_required = YES;
|
|
-
|
|
|
|
G_option_requires(flag_p, parm.input, NULL);
|
|
G_option_requires(flag_p, parm.input, NULL);
|
|
|
|
|
|
/* The parser checks if the map already exists in current mapset, this is
|
|
/* The parser checks if the map already exists in current mapset, this is
|
|
@@ -299,7 +306,7 @@ int main(int argc, char *argv[])
|
|
exit(EXIT_SUCCESS);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
}
|
|
|
|
|
|
- if (!parm.outloc->answer &&
|
|
|
|
|
|
+ if (output && !parm.outloc->answer &&
|
|
GDALGetRasterCount(hDS) == 1) { /* Check if the map exists */
|
|
GDALGetRasterCount(hDS) == 1) { /* Check if the map exists */
|
|
if (G_find_raster2(output, G_mapset())) {
|
|
if (G_find_raster2(output, G_mapset())) {
|
|
if (overwrite)
|
|
if (overwrite)
|
|
@@ -411,6 +418,8 @@ int main(int argc, char *argv[])
|
|
G_warning(_("Unable to convert input raster map projection information to "
|
|
G_warning(_("Unable to convert input raster map projection information to "
|
|
"GRASS format for checking"));
|
|
"GRASS format for checking"));
|
|
else {
|
|
else {
|
|
|
|
+ void (*msg_fn)(const char *, ...);
|
|
|
|
+
|
|
/* -------------------------------------------------------------------- */
|
|
/* -------------------------------------------------------------------- */
|
|
/* Does the projection of the current location match the */
|
|
/* Does the projection of the current location match the */
|
|
/* dataset? */
|
|
/* dataset? */
|
|
@@ -510,11 +519,24 @@ int main(int argc, char *argv[])
|
|
strcat(error_msg,
|
|
strcat(error_msg,
|
|
_("Consider generating a new location from the input dataset using "
|
|
_("Consider generating a new location from the input dataset using "
|
|
"the 'location' parameter.\n"));
|
|
"the 'location' parameter.\n"));
|
|
- G_fatal_error(error_msg);
|
|
|
|
|
|
+
|
|
|
|
+ if (flag_j->answer)
|
|
|
|
+ msg_fn = G_message;
|
|
|
|
+ else
|
|
|
|
+ msg_fn = G_fatal_error;
|
|
|
|
+ msg_fn(error_msg);
|
|
|
|
+ if (flag_j->answer)
|
|
|
|
+ exit(EXIT_FAILURE);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- G_verbose_message(_("Projection of input dataset and current location "
|
|
|
|
- "appear to match"));
|
|
|
|
|
|
+ if (flag_j->answer)
|
|
|
|
+ msg_fn = G_message;
|
|
|
|
+ else
|
|
|
|
+ msg_fn = G_verbose_message;
|
|
|
|
+ msg_fn(_("Projection of input dataset and current location "
|
|
|
|
+ "appear to match"));
|
|
|
|
+ if (flag_j->answer)
|
|
|
|
+ exit(EXIT_SUCCESS);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -819,8 +841,6 @@ int main(int argc, char *argv[])
|
|
G_message(_("Region for the current mapset updated"));
|
|
G_message(_("Region for the current mapset updated"));
|
|
}
|
|
}
|
|
|
|
|
|
- G_done_msg(" ");
|
|
|
|
-
|
|
|
|
exit(EXIT_SUCCESS);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
}
|
|
|
|
|