Skip to content

v.proj: Seed region from default window to ignore region override#7578

Open
petrasovaa wants to merge 2 commits into
OSGeo:mainfrom
petrasovaa:v.proj-fix-region
Open

v.proj: Seed region from default window to ignore region override#7578
petrasovaa wants to merge 2 commits into
OSGeo:mainfrom
petrasovaa:v.proj-fix-region

Conversation

@petrasovaa

Copy link
Copy Markdown
Contributor

This came up when i was testing r.in.ssurgo addon in parallel within RegionManager which uses WIND_OVERRIDE. v.proj was throwing:

Unable to open element file <windows> for <local_region@PERMANENT>

Added test.

More info:

Details When v.proj switches into the source project to read the input vector, it seeded its working region with G_get_window(), which honors WIND_OVERRIDE and GRASS_REGION. Those name a region in the caller's mapset, not in the source project, so the read failed with "Unable to open element file " whenever v.proj ran under a named temporary region (e.g. inside RegionManager, use_temp_region(), or parallel pipelines).

Read the source project's default window instead. The seed value is
overwritten field by field from the input vector's extent immediately
afterward, so seeding from the default window is sufficient and does not
consult the override. G_unset_window() is dropped since it only existed
to defeat G_get_window()'s cache.

Add a regression test that runs v.proj with WIND_OVERRIDE naming a region
present only in the target mapset

@github-actions github-actions Bot added vector Related to vector data processing Python Related code is in Python C Related code is in C module tests Related to Test Suite labels Jun 16, 2026
Comment thread vector/v.proj/main.c Outdated
Comment thread vector/v.proj/main.c Outdated
Comment thread vector/v.proj/tests/v_proj_wind_override_test.py Outdated
@petrasovaa petrasovaa requested a review from wenzeslaus June 19, 2026 15:59

@wenzeslaus wenzeslaus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Tools also for g.region and g.findfile.

Comment on lines +41 to +50
gs.run_command(
"g.region",
n=300000,
s=200000,
e=700000,
w=600000,
res=10,
save="local_region",
env=session.env,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The g.region call as well and find_file can be replaced by tools (no explicit env=session.env and more consistent overall; would make a good example).

Since the introduction of find_file wrapper, g.findfile gained JSON output and the return value was fixed to a more expected behavior for a GRASS tool, while the test unix utility behavior is available with a flag (not by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C Related code is in C module Python Related code is in Python tests Related to Test Suite vector Related to vector data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants