[GRASS-dev] [GRASS GIS] #4021: r.import/v.import: confusing error message "ERROR: proj"

#4021: r.import/v.import: confusing error message "ERROR: proj"
--------------------------------+---------------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.8.3
Component: Raster | Version: git-releasebranch78
Keywords: r.import, v.import | CPU: Unspecified
Platform: Unspecified |
--------------------------------+---------------------------------
For most users the "ERROR: proj" part in the notification which CRS was
found and that the reprojection does not match that of the current
location is confusing, also in a technical sense as it is sent to stderr:

{{{
grass78 ~/grassdata/nc_spm_08/user1

# generate test data
v.out.ogr input=roadsmajor output=roadsmajor.gpkg
ogr2ogr -t_srs epsg:4326 roadsmajor_LL.gpkg roadsmajor.gpkg

v.import input=roadsmajor_LL.gpkg output=test --o
WARNING: Projection of dataset does not appear to match current location.

          Location PROJ_INFO is:
          name: Lambert Conformal Conic
          proj: lcc
          datum: nad83
          a: 6378137.0
          es: 0.006694380022900787
          lat_1: 36.16666666666666
          lat_2: 34.33333333333334
          lat_0: 33.75
          lon_0: -79
          x_0: 609601.22
          y_0: 0
          no_defs: defined
          init: EPSG:3358

          Dataset PROJ_INFO is:
          name: WGS 84
          datum: wgs84
          ellps: wgs84
          proj: ll
          no_defs: defined

          ERROR: proj <=== ?!
Importing <roadsmajor_LL.gpkg> ...
Check if OGR layer <roadsmajor> contains polygons...
  100%
Creating attribute table for layer <roadsmajor>...
Default driver / database set to:
driver: sqlite
database: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
Column name <cat> renamed to <cat_>
Importing 355 features (OGR layer <roadsmajor>)...
  100%
-----------------------------------------------------
Building topology for vector map <test@PERMANENT>...
Registering primitives...
Reprojecting <test>...
WARNING: Vector map <test> already exists and will be overwritten
Reprojecting primitives ...
Building topology for vector map <test@user1>...
Registering primitives...
}}}

Hence, "ERROR" followed by "Importing..." is not ideal.

I didn't get yet an idea since the message is composed in
r.in.gdal/v.in.ogr:

https://github.com/OSGeo/grass/blob/master/raster/r.in.gdal/proj.c#L196

Effectively, the "ERROR" part should be suppressed when r.in.gdal was
called by r.import (v.in.ogr respectively).

Any ideas?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4021&gt;
GRASS GIS <https://grass.osgeo.org>

#4021: r.import/v.import: confusing error message "ERROR: proj"
--------------------------+---------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.3
Component: Raster | Version: git-releasebranch78
Resolution: | Keywords: r.import, v.import
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

We could always just rename 'ERROR' to something like 'Difference in:'
since that is the meaning right?

But I don't like the entire warning, it's too long. Maybe we could set
verbosity level to -1 for that r.in.gdal call unless r.import is called
with --v.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4021#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#4021: r.import/v.import: confusing error message "ERROR: proj"
--------------------------+---------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.3
Component: Raster | Version: git-releasebranch78
Resolution: | Keywords: r.import, v.import
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mmetz):

Replying to [comment:1 annakrat]:
> We could always just rename 'ERROR' to something like 'Difference in:'
since that is the meaning right?

Using 'Difference in:' is a good idea and explains better why two CRS's
differ. Note that this would need to be changed in r.in.gdal, r.external,
v.in.ogr, v.external.
>
> But I don't like the entire warning, it's too long. Maybe we could set
verbosity level to -1 for that r.in.gdal call unless r.import is called
with --v.

IMHO, it depends on how r.in.gdal is used. Currently, when using the -j
flag (Perform projection check only and exit), a warning is issued. This
could be changed to a `G_message()` which can be suppressed with --quiet
if r.in.gdal in run in a script such as r.import. Again, changing
`G_warning()` to `G_message()` should be done in r.in.gdal, r.external,
v.in.ogr, v.external.

When r.in.gdal is used without the -j flag, the different CRS's and the
first encountered difference should be reported as done now (using
'Difference in: ...' instead of 'ERROR: ...'

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4021#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#4021: r.import/v.import: confusing error message "ERROR: proj"
--------------------------+---------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.3
Component: Raster | Version: git-releasebranch78
Resolution: | Keywords: r.import, v.import
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by annakrat):

Replying to [comment:2 mmetz]:
> Replying to [comment:1 annakrat]:
> > We could always just rename 'ERROR' to something like 'Difference in:'
since that is the meaning right?
>
> Using 'Difference in:' is a good idea and explains better why two CRS's
differ. Note that this would need to be changed in r.in.gdal, r.external,
v.in.ogr, v.external.
> >
> > But I don't like the entire warning, it's too long. Maybe we could set
verbosity level to -1 for that r.in.gdal call unless r.import is called
with --v.
>
> IMHO, it depends on how r.in.gdal is used. Currently, when using the -j
flag (Perform projection check only and exit), a warning is issued. This
could be changed to a `G_message()` which can be suppressed with --quiet
if r.in.gdal in run in a script such as r.import. Again, changing
`G_warning()` to `G_message()` should be done in r.in.gdal, r.external,
v.in.ogr, v.external.
>

> When r.in.gdal is used without the -j flag, the different CRS's and the
first encountered difference should be reported as done now (using
'Difference in: ...' instead of 'ERROR: ...'

+1

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4021#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#4021: r.import/v.import: confusing error message "ERROR: proj"
--------------------------+---------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.3
Component: Raster | Version: git-releasebranch78
Resolution: fixed | Keywords: r.import, v.import
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by neteler):

* status: new => closed
* resolution: => fixed

Comment:

Fixed in https://github.com/OSGeo/grass/pull/317

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/4021#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>