Opened 5 years ago

Closed 5 years ago

#4021 closed defect (fixed)

r.import/v.import: confusing error message "ERROR: proj"

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Raster Version: git-releasebranch78
Keywords: r.import, v.import Cc:
CPU: Unspecified Platform: Unspecified

Description

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?

Change History (4)

comment:1 by annakrat, 5 years ago

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.

in reply to:  1 ; comment:2 by mmetz, 5 years ago

Replying to 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: ...'

in reply to:  2 comment:3 by annakrat, 5 years ago

Replying to mmetz:

Replying to 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

comment:4 by neteler, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.