Skip to content

Commit

Permalink
r.in.wms: fix get region extent for WMS query, if location is 'XY loc…
Browse files Browse the repository at this point in the history
…ation (unprojected)' (#853)
  • Loading branch information
tmszi authored May 2, 2024
1 parent 943de90 commit 55b34ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion scripts/m.proj/m.proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def main():
# set up projection params
s = gcore.read_command("g.proj", flags="j")
kv = parse_key_val(s)
if "XY location" in kv["+proj"] and (ll_in or ll_out):
if "XY location" in kv:
gcore.fatal(_("Unable to project to or from a XY location"))

in_proj = None
Expand Down
22 changes: 13 additions & 9 deletions scripts/r.in.wms/wms_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,20 @@ def _computeBbox(self):
grass.fatal(_("Unable to write data into tempfile"))
finally:
temp_region_opened.close()
try:
points = grass.read_command(
"m.proj",
flags="d",
proj_out=self.proj_srs,
proj_in=self.proj_location,
input=temp_region,
quiet=True,
) # TODO: stdin
except CalledModuleError:
points = None
finally:
grass.try_remove(temp_region)

points = grass.read_command(
"m.proj",
flags="d",
proj_out=self.proj_srs,
proj_in=self.proj_location,
input=temp_region,
quiet=True,
) # TODO: stdin
grass.try_remove(temp_region)
if not points:
grass.fatal(_("Unable to determine region, %s failed") % "m.proj")

Expand Down

0 comments on commit 55b34ae

Please sign in to comment.