Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch environment: also change mapset #286

Merged
merged 2 commits into from
Jan 16, 2020
Merged

Conversation

metzm
Copy link
Contributor

@metzm metzm commented Jan 16, 2020

WIP because this exposes a bug in r.import: a temp region with WIND_OVERRIDE can not be used with r.proj/v.proj because the location and mapset need to be switched during reprojection, and the env var WIND_OVERRIDE applies only to the location/mapset where it was established -> unable to find the region def given with WIND_OVERRIDE in the source location/mapset.

@metzm metzm added bug Something isn't working backport_needed labels Jan 16, 2020
use current (target) location + mapset when calling GPJ_init_transform()
@metzm
Copy link
Contributor Author

metzm commented Jan 16, 2020

The bug in r.import is avoided with the second commit, as long as r.proj does not use G_get_window() in the source (input) location + mapset.

@metzm
Copy link
Contributor Author

metzm commented Jan 16, 2020

@neteler @landam This PR fixes an important bug in r.proj which also affects r.import. I recommend a new bugfix release of GRASS 7.8.

@metzm metzm merged commit 804867d into OSGeo:master Jan 16, 2020
@metzm metzm deleted the switch_env branch January 16, 2020 19:47
metzm added a commit that referenced this pull request Jan 16, 2020
* switch environment: also change mapset

* r.proj: use current (target) location + mapset when calling GPJ_init_transform(), needed to get the correct region to be passed as area of interest to PROJ6+
@neteler
Copy link
Member

neteler commented Jan 17, 2020

@metzm Thanks for catching this!

I searched for further candidates with
ag 'G_setenv_nogisrc\("LOCATION_NAME"' - so I found more

Question: is this fix also needed in

  • imagery/i.rectify/target.c
  • vector/v.rectify/target.c
  • ...
    ?

@metzm
Copy link
Contributor Author

metzm commented Jan 17, 2020

I checked all occurrences of G_create_alt_env(), including i.rectify and v.rectify. These modules are not affected, i.e. G_create_alt_env() is used correctly.

landam pushed a commit to landam/grass that referenced this pull request Jan 28, 2020
* switch environment: also change mapset

* r.proj: use current (target) location + mapset when calling GPJ_init_transform(), needed to get the correct region to be passed as area of interest to PROJ6+
petrasovaa pushed a commit to petrasovaa/grass that referenced this pull request Feb 18, 2020
* switch environment: also change mapset

* r.proj: use current (target) location + mapset when calling GPJ_init_transform(), needed to get the correct region to be passed as area of interest to PROJ6+
@wenzeslaus
Copy link
Member

To clarify this for anybody who would get the r.import issue: The error message from r.import with default parameters (i.e., extent=input) is:

ERROR: Unable to open element file <windows> for <tmp.r.import.py.4004@PERMANENT>
ERROR: Unable to get reprojected map extent

This is present in 7.8.2 and happens only when r.import really needs to reproject. The PR is merged and the r.import will be fixed in future releases (now available using the development version). Thanks @metzm for the fix!

@neteler
Copy link
Member

neteler commented Feb 29, 2020

To clarify this for anybody who would get the r.import issue: The error message from r.import with default parameters (i.e., extent=input) is:

ERROR: Unable to open element file <windows> for <tmp.r.import.py.4004@PERMANENT>
ERROR: Unable to get reprojected map extent

This is present in 7.8.2 and happens only when r.import really needs to reproject.

Do you mean that there are still open issues in 7.8.2? The fix was backported AFAIK...

@wenzeslaus
Copy link
Member

This PR is from January, but 7.8.2 is from December, so I assume the fix is not there, although it might be in the 7.8 branch, but maybe I'm missing something.

@neteler neteler added this to the 8.0.0 milestone Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants