grass icon indicating copy to clipboard operation
grass copied to clipboard

[Bug] m.proj and r.tileset fail with PROJ 8

Open wenzeslaus opened this issue 4 years ago • 1 comments

Describe the bug

  • r.tileset test fails with PROJ 8 with cannot expand +init=epsg:4326 +type=crs.
  • Changing +init=epsg:4326 to epsg:4326 (which AFAIU should work) fails in m.proj because m.proj requires the string to start with +.

To Reproduce

Run scripts/r.tileset/testsuite/test_r_tileset.py (Produce tiling test):

  • Use GRASS compiled with PROJ 8
  • Use nc_spm_full_v2alpha2/user1/.
  • cd into GRASS source code.
  • Run python scripts/r.tileset/testsuite/test_r_tileset.py.

Expected behavior

Syntax is accepted according to the PROJ version.

Should m.proj even try to do any CRS definition validation on its own or just make sure PROJ errors are nicely passed through?

Screenshots

Traceback (most recent call last):
  File "scripts/r.tileset/testsuite/test_r_tileset.py", line 44, in test_tiling
    self.assertModule(module)
  File "etc/python/grass/gunittest/case.py", line 1419, in assertModule
    self.fail(self._formatMessage(msg, stdmsg))
AssertionError: Running <r.tileset> module ended with non-zero return code (1)
Called: r.tileset(sourceproj='+init=epsg:4326', sourcescale='1', maxcols=2048, maxrows=1024, overlap=0, separator='pipe')
See the following errors:
Invalid content for epsg
proj_create: cannot expand +init=epsg:4326 +type=crs
Rel. 8.0.1, March 5th, 2021
<cs2cs>: 
cannot instantiate target coordinate system
program abnormally terminated
WARNING: Projection transform probably failed, please investigate
ERROR: cs2cs failed

System description

version=8.0.dev
date=2021
revision=d03c8cb
build_date=2021-07-26
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=d03c8cb
libgis_date=2021-07-27T01:21:28+00:00
proj=8.0.1
gdal=3.3.1
geos=3.9.1
sqlite=3.36.0

wenzeslaus avatar Jul 29 '21 01:07 wenzeslaus

I recommend to leave CRS definition validation entirely to PROJ because with new PROJ versions there is a number of different ways to define a CRS (a proj string is actually deprecated for CRS definition). Note that for new PROJ versions it should be upper case "EPSG:4326" while for old versions (4, 5) it should be lower case "+init=epsg:4326".

metzm avatar Aug 15 '21 15:08 metzm