[GRASS-git] [OSGeo/grass-addons] da14e6: r.in.nasadem + r.in.srtm.region: fix PROJ parsing ...

Markus Neteler noreply at github.com
Wed Apr 14 00:41:48 PDT 2021


  Branch: refs/heads/master
  Home:   https://github.com/OSGeo/grass-addons
  Commit: da14e615e126194172509b93ef7f58bef5b997ae
      https://github.com/OSGeo/grass-addons/commit/da14e615e126194172509b93ef7f58bef5b997ae
  Author: Markus Neteler <neteler at gmail.com>
  Date:   2021-04-14 (Wed, 14 Apr 2021)

  Changed paths:
    M grass7/raster/r.in.nasadem/r.in.nasadem.py
    M grass7/raster/r.in.srtm.region/r.in.srtm.region.py

  Log Message:
  -----------
  r.in.nasadem + r.in.srtm.region: fix PROJ parsing (#500)

* r.in.nasadem + r.in.srtm.region: fix PROJ parsing

Due to https://github.com/OSGeo/grass/pull/1240 the output structure of `g.proj -g` changed, leading to

```
r.in.nasadem user='neteler' password='XXXXXXXXX' output=nasadem resolution=30
Traceback (most recent call last):
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 631, in <module>
    main()
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 475, in main
    SRCGISRC, TMPLOC = createTMPlocation()
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 342, in createTMPlocation
    if grass.parse_command('g.proj', flags='g')['EPSG'] != str(epsg):
KeyError: 'EPSG'
ERROR: Region <r_in_nasadem_region_409609> not found
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 312, in cleanup
    grass.run_command("g.region", region=tmpregionname)
  File "/home/mundialis/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 441, in run_command
    return handle_errors(returncode, returncode, args, kwargs)
  File "/home/mundialis/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 342, in handle_errors
    raise CalledModuleError(module=None, code=code,
grass.exceptions.CalledModuleError: Module run None g.region region=r_in_nasadem_region_409609 ended with error
Process ended with non-zero return code 1. See errors in the (error) output.
```

The change is the introduction of `srid`:

```
{'name': 'WGS 84', 'datum': 'wgs84', 'ellps': 'wgs84', 'proj': 'll', 'no_defs': 'defined', 'srid': 'EPSG:4326', 'unit': 'degree', 'units': 'degrees', 'meters': '1.0'}
```

which is addressed by this PR (feedback concerning the Python style is welcome).

Fixes
- r.in.nasadem
- r.in.srtm.region

(perhaps other addons are affected as well)

Co-authored-by: Guido Riembauer <62383722+griembauer at users.noreply.github.com>




More information about the grass-commit mailing list