Repository navigation
Conversation
This PR exposes the already existing support for `authority:code` to the command line interface. So far, `create_project()` only understood `EPSG:...` or an existing georeferenced file. Any other `authority:code` string (e.g. `ESRI:102022`) was treated as a filename With this PR, `python/grass/script/core.py` (`create_project()`) now treats any `-c`/`crs` value that isn't an existing path as an `authority:code` and passes it straight through as `g.proj srid=<value>`. Like this, it exposes the existing `g.proj srid=` capability (which already handled e.g. `ESRI:102022`) through `grass -c ...`. Existing georeferenced files and `EPSG:code[:datum_trans]` keep their current behavior. **Details** - `python/grass/script/core.py` (`create_project`): treat any `-c` value that is not an existing path as an `authority:code` and pass it straight through as `g.proj srid=<value>`. Existing files are still read as georeferenced sources, and `EPSG:code[:datum_trans]` keeps its existing behavior (including datum transform handling). This exposes the `g.proj srid=` capability through the start script/startup code. - Docs: `lib/init/grass.md`/`grass.html` synopsis, flag, and example updated. - Tests: unit tests for `ESRI:102022` success and invalid authority failure; CLI regression tests confirming `grass -c ESRI:102022 ... -e` creates the project and `grass -c EPSG:999999 ... -e` exits non-zero with no traceback. **Tests** - `pytest python/grass/script/tests/grass_script_core_location_test.py` extended with `test_crs_parameter_authority_code()` and `test_crs_parameter_invalid_authority_code`
|
Examples for accepted
|
Co-authored-by: Markus Metz <33666869+metzm@users.noreply.github.com>
wenzeslaus
left a comment
There was a problem hiding this comment.
I'm also for shortening the doc. I think EPSG items can be replaced by the new SRS/CRS ID in the doc.
|
Updates in e4929e5: Implementation
grass --help
GRASS 8.6.0dev
Geographic Resources Analysis Support System (GRASS).
Usage:
grass [-h | --help] [-v | --version]
[-c | -c geofile | -c EPSG:code[:datum_trans] | -c XY]
[-e] [-f] [--text | --gtext | --gui] [--config param]
[[[GISDBASE/]PROJECT/]MAPSET]
grass [FLAG]... GISDBASE/PROJECT/MAPSET --exec EXECUTABLE [EPARAM]...
grass --tmp-project [geofile | spatial_reference_id | XY] --exec EXECUTABLE [EPARAM]...
grass --tmp-mapset GISDBASE/PROJECT/ --exec EXECUTABLE [EPARAM]...
[...]Tests:
|
|
I have doubts about
because some information on datum transformation requires not only a source datum, but also a target datum which is no longer by default WGS84. Thus the syntax |
This should be addressed in a separate PR also cleaning up |
wenzeslaus
left a comment
There was a problem hiding this comment.
The change looks great.
Just be careful with commit message. I think the last comment doesn't fit 100% with the EPSG:xxxx:yyyy handling.
I agree with @metzm that EPSG:xxxx:yyyy is for a separate PR. One option there is to phase that so that it first creates a warning (let's say in 8.6.0 and after branching off 8.6, we remove it for 8.7, alternatively, we just announce at 8.6.0 and shift the removal down the line, so the actual removal would be 8.8).
@wenzeslaus I am not 100% sure what you mean. Do you refer to the initial PR description? The rest is squashed anyway... |
|
In your recent comment, a bullet point says that anything non path goes as srid. That's the case for epsg, even without datum syntax, in the code. Separately, a simple GH generated message usually doesn't describe the change well I would say. |
|
I have updated the PR description. |
This PR exposes the already existing support for
authority:codeto the command line interface. So far,create_project()only understoodEPSG:...or an existing georeferenced file. Any otherauthority:codestring (e.g.ESRI:102022) was treated as a filename.With this PR,
python/grass/script/core.py(create_project) now treats any-c/crsvalue that is not an existing path as a PROJ spatial reference ID and passes it straight through asg.proj srid=<value>.This exposes the existing
g.proj srid=capability throughgrass -c .... Existing georeferenced files are still read as georeferenced sources, andEPSG:code[:datum_trans]is kept for compatibility (GRASS custom syntax).Details
python/grass/script/core.py(create_project): treat any-cvalue that is not an existing path as PROJ spatial reference ID and pass it straight through asg.proj srid=<value>. Existing files are still read as georeferenced sources, andEPSG:code[:datum_trans]keeps its existing behavior.lib/init/grass.md/grass.html: synopsis and flags now use-c spatial_reference_idand point to https://proj.org/en/stable/apps/projinfo.html for supported definitions;--tmp-projecthelp text updated accordingly.ESRI:102022success and invalid ID failure; CLI regression tests confirminggrass -c ESRI:102022 ... -ecreates the project andgrass -c EPSG:999999 ... -eexits non-zero with no traceback.Example
Tests
pytest python/grass/script/tests/grass_script_core_location_test.pyextended withtest_crs_parameter_authority_code_syntax()andtest_crs_parameter_invalid_id.Disclosure: AI-assisted (Deepseek Flash model) - used for implementing the improvements, verified and tested by me.