[Bug] v.import datum_trans=-1 fails
Describe the bug
If datum_trans parameter is set to -1, that should print datum transformation info, it actually results in a Python traceback as code calls g.proj without providing a -p flag.
To reproduce
v.import input=tp_92_20_92.gpkg epsg=3059 datum_trans=-1
KĻŪDA: No output format specified. Define one of the options: plain,
shell, json, wkt, or proj4 using the -p flag.
Traceback (most recent call last):
File "scripts/v.import", line 398, in <module>
sys.exit(main())
~~~~^^
File "scripts/v.import", line 208, in main
return gs.run_command(
~~~~~~~~~~~~~~^
"g.proj", epsg=options["epsg"], datum_trans=options["datum_trans"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "etc/python/grass/script/core.py", line 522, in run_command
return handle_errors(returncode, result=None, args=args, kwargs=kwargs)
File "etc/python/grass/script/core.py", line 375, in handle_errors
raise CalledModuleError(module=module, code=code, returncode=returncode)
grass.exceptions.CalledModuleError: Module run `g.proj epsg=3059 datum_trans=-1` ended with an error.
The subprocess ended with a non-zero return code: 1. See errors above the traceback or in the error output.
Expected behavior
Datum transformation information is printed (as per documentation).
System description
Current main on Linux.
For posterity: current commit on main is ad6e958c27a6ed7228e3cf7c40a2a63ea9949c58
I tried testing it in 8.4 and it seems to fail too. I was trying to find where this got broken but I couldn't find it.
The call "g.proj", epsg=options["epsg"], datum_trans=options["datum_trans"] comes from the old PROJ4 times when WGS84 was the pivot datum. Nowadways since PROJ 6 this does not make sense any more because WGS84 is no longer used as pivot. In order to get transformation information, two different CRSs, source and target, need to be given, and the transformation pipeline might or might not use WGS84. If compiled against PROJ 6 or later, g.proj should refuse to print datum transformation for a given CRS. v.import could instead use projinfo -s ... -t ... -o ....