Skip to content

Commit

Permalink
wxGUI AddWSDialog: fix render WMTS layer with OGC:CRS84 coor system (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi authored and petrasovaa committed Jun 4, 2020
1 parent 6870959 commit 8c28dad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions gui/wxpython/web_services/widgets.py
Expand Up @@ -16,6 +16,7 @@
@author Stepan Turek <stepan.turek seznam.cz>
"""

import re
import os
import sys
import six
Expand Down Expand Up @@ -709,7 +710,9 @@ def CreateCmd(self):

if 'srs' not in self.drv_props['ignored_params']:
i_srs = self.params['srs'].GetSelection()
epsg_num = int(self.projs_list[i_srs].split(':')[-1])
srs = self.projs_list[i_srs].split(':')[-1]
epsg_num = int(''.join(re.findall(r'\d+', srs)))

lcmd.append("srs=%s" % epsg_num)

for k in ['maxcols', 'maxrows', 'urlparams']:
Expand Down Expand Up @@ -774,11 +777,8 @@ def OnListSelChanged(self, event):
proj_code = Srs(proj.strip()).getcode()
proj_spl = proj_code.split(':')
if proj_spl[0].strip().lower() in self.drv_info.GetSrs():
try:
int(proj_spl[1])
self.projs_list.append(proj_code)
except ValueError as IndexError:
continue
# accept ogc:crs code
self.projs_list.append(proj_code)

cur_sel = self.params['srs'].GetStringSelection()

Expand Down
6 changes: 3 additions & 3 deletions scripts/r.in.wms/wms_base.py
Expand Up @@ -612,7 +612,7 @@ def __init__(self):
"image/gif",
"image/png8"]

self.srs = ("epsg", "crs")
self.srs = ("epsg", "ogc")

def GetDrvProperties(self, driver):
"""!Get information about driver parameters.
Expand Down Expand Up @@ -692,9 +692,9 @@ def GetSRSParamVal(srs):
"""

if srs in [84, 83, 27]:
return "CRS:%d" % srs
return "OGC:CRS{}".format(srs)
else:
return "EPSG:%d" % srs
return "EPSG:{}".format(srs)


def GetEpsg(srs):
Expand Down
4 changes: 2 additions & 2 deletions scripts/r.in.wms/wms_drv.py
Expand Up @@ -44,7 +44,7 @@
except ImportError: # < Python 2.7
from xml.parsers.expat import ExpatError as ParseError

from wms_base import WMSBase, GetSRSParamVal
from wms_base import GetEpsg, GetSRSParamVal, WMSBase

from wms_cap_parsers import WMTSCapabilitiesTree, OnEarthCapabilitiesTree
from srs import Srs
Expand Down Expand Up @@ -225,7 +225,7 @@ def _download(self):
# georeferencing and setting projection of temp_map
projection = grass.read_command('g.proj',
flags='wf',
epsg=self.params['srs'])
epsg=GetEpsg(self.params['srs']))
projection = projection.rstrip('\n')
temp_map_dataset.SetProjection(projection)

Expand Down

0 comments on commit 8c28dad

Please sign in to comment.