grass icon indicating copy to clipboard operation
grass copied to clipboard

gui: restrict north/south to 90/-90 and west/east to -180/180

Open HuidaeCho opened this issue 4 years ago • 3 comments
trafficstars

How to reproduce the issue that this PR fixes

grass -c epsg:4326 test
# set the world region
g.region n=90 s=-90 w=-180 e=180
g.gui
# add OpenStreetMap WMS through GUI

image

Get the following error:

GRASS_INFO_ERROR(14353,1): Illegal latitude for North: 112.855
GRASS_INFO_END(14353,1)
Traceback (most recent call last):
  File "/home/user/usr/grass/grass/dist.x86_64-pc-linux-gnu/gui/scripts/d.wms", line 218, in <module>
    sys.exit(main())
  File "/home/user/usr/grass/grass/dist.x86_64-pc-linux-gnu/gui/scripts/d.wms", line 210, in main
    temp_map = wms.GetMap(options, flags)
  File "/home/user/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/r.in.wms/wms_base.py", line 229, in GetMap
    self._initializeParameters(options, flags)
  File "/home/user/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/r.in.wms/wms_base.py", line 129, in _initializeParameters
    self.proj_location = grass.read_command("g.proj", flags="jf").rstrip("\n")
  File "/home/user/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 610, in read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "/home/user/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 428, in handle_errors
    raise CalledModuleError(module=module, code=code, returncode=returncode)
grass.exceptions.CalledModuleError: Module run `g.proj -jf` ended with an error.
The subprocess ended with a non-zero return code: 1. See errors above the traceback or in the error output.

GRASS_INFO_ERROR(14354,1): Module run `d.wms --q wms_version=1.1.1 driver=WMS_GRASS url=https://ows.terrestris.de/osm/service? layers=OSM-WMS styles= format=png srs=4326 maxcols=500 maxrows=500 urlparams= method=cubicspline map=OpenStreetMap WMS - by terrestris` ended with an error.

GRASS_INFO_ERROR(14354,1): The subprocess ended with a non-zero return code: 1. See errors above the traceback or in the error output.
GRASS_INFO_END(14354,1)
ERROR 4: /home/user/tmp/test/PERMANENT/.tmp/yoga/13841.4: No such file or directory
ERROR 4: /home/user/tmp/test/PERMANENT/.tmp/yoga/13841.4: No such file or directory

Why it happens

The following line adjusts north=90 and south=-90 to north=112.85540704139999 and south=-112.8554070414 using the aspect ratio of the display: https://github.com/OSGeo/grass/blob/75dd60a694198f7bca17b7e3d6387b6eefa9bb7a/gui/wxpython/core/ws.py#L98

Solution

This PR restricts the limits of north/south/west/east to 90/-90/-180/180 in _fitAspect().

BUT?

The world OSM basemap extends beyond the world region? image

HuidaeCho avatar Sep 19 '21 20:09 HuidaeCho

The world OSM basemap extends beyond the world region?

This often happens when displaying whole world not just here. Perhaps discrepancy between how GUI and how display library handle LL as projection?

wenzeslaus avatar Dec 09 '21 21:12 wenzeslaus

The world OSM basemap extends beyond the world region?

This often happens when displaying whole world not just here. Perhaps discrepancy between how GUI and how display library handle LL as projection?

@wenzeslaus I'm not sure. For now, this PR fixes the invalid coordinate error for LL locations, but not this extending basemap problem.

HuidaeCho avatar Mar 18 '22 03:03 HuidaeCho

Since the 8.0.2 milestone is due now - to which milestone may this report be bumped?

neteler avatar Mar 31 '22 06:03 neteler