[GRASS-SVN] r74193 - grass/trunk/general/g.proj
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Mar 8 11:35:38 PST 2019
Author: mmetz
Date: 2019-03-08 11:35:38 -0800 (Fri, 08 Mar 2019)
New Revision: 74193
Modified:
grass/trunk/general/g.proj/main.c
Log:
g.proj: also list SRS without proj definition
Modified: grass/trunk/general/g.proj/main.c
===================================================================
--- grass/trunk/general/g.proj/main.c 2019-03-08 19:31:28 UTC (rev 74192)
+++ grass/trunk/general/g.proj/main.c 2019-03-08 19:35:38 UTC (rev 74193)
@@ -265,7 +265,8 @@
PROJ_CRS_INFO **proj_crs_info;
crs_cnt = 0;
- proj_crs_info = proj_get_crs_info_list_from_database(NULL, listcodes->answer, NULL, &crs_cnt);
+ proj_crs_info = proj_get_crs_info_list_from_database(NULL,
+ listcodes->answer, NULL, &crs_cnt);
if (crs_cnt < 1)
G_fatal_error(_("No codes found for authority %s"),
listcodes->answer);
@@ -272,8 +273,10 @@
for (i = 0; i < crs_cnt; i++) {
const char *proj_definition;
+ char emptystr;
PJ *pj;
+ emptystr = '\0';
pj = proj_create_from_database(NULL,
proj_crs_info[i]->auth_name,
proj_crs_info[i]->code,
@@ -281,21 +284,19 @@
0, NULL);
proj_definition = proj_as_proj_string(NULL, pj, PJ_PROJ_5, NULL);
if (!proj_definition) {
- int err = proj_errno(pj);
-
- if (err) {
- G_warning(_("Unable to fetch proj string: %s"),
- proj_errno_string(err));
- }
- else {
- G_warning(_("Unable to fetch proj string: unknown error"));
- }
+ /* what to do with a CRS without proj string ? */
+ G_debug(1, "No proj string for %s:%s",
+ proj_crs_info[i]->auth_name,
+ proj_crs_info[i]->code);
+ proj_definition = &emptystr;
}
- else {
+
+ if (proj_definition) {
fprintf(stdout, "%s|%s|%s\n", proj_crs_info[i]->code,
proj_crs_info[i]->name,
proj_definition);
}
+
proj_destroy(pj);
}
#else
More information about the grass-commit
mailing list