From beeff971cd766be26db0fe04ae56390a2c9a2edc Mon Sep 17 00:00:00 2001 From: Tomas Zigo Date: Thu, 30 Jul 2020 07:58:03 +0200 Subject: [PATCH] r.in.wms: fix get region extent for WMS query, if location is 'XY location (unprojected)' --- scripts/m.proj/m.proj.py | 2 +- scripts/r.in.wms/wms_base.py | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/m.proj/m.proj.py b/scripts/m.proj/m.proj.py index aad74a3b9a7..aae8cf2d2c1 100755 --- a/scripts/m.proj/m.proj.py +++ b/scripts/m.proj/m.proj.py @@ -161,7 +161,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 diff --git a/scripts/r.in.wms/wms_base.py b/scripts/r.in.wms/wms_base.py index b7a284415fc..5982259523e 100644 --- a/scripts/r.in.wms/wms_base.py +++ b/scripts/r.in.wms/wms_base.py @@ -327,13 +327,16 @@ def _computeBbox(self): grass.fatal(_("Unable to write data into tempfile")) finally: temp_region_opened.close() - - 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) + 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) if not points: grass.fatal(_("Unable to determine region, %s failed") % 'm.proj')