|
@@ -290,6 +290,9 @@ class BaseRequestMgr:
|
|
if self.t_num_bbox['max_row'] > (mat_num_bbox['max_row']):
|
|
if self.t_num_bbox['max_row'] > (mat_num_bbox['max_row']):
|
|
self.t_num_bbox['max_row'] = int(mat_num_bbox['max_row'])
|
|
self.t_num_bbox['max_row'] = int(mat_num_bbox['max_row'])
|
|
|
|
|
|
|
|
+
|
|
|
|
+ grass.debug('t_num_bbox: min_col:%d max_col:%d min_row:%d max_row:%d' % (self.t_num_bbox['min_col'], self.t_num_bbox['max_col'], self.t_num_bbox['min_row'], self.t_num_bbox['max_row']), 3)
|
|
|
|
+
|
|
num_tiles = (self.t_num_bbox['max_col'] - self.t_num_bbox['min_col'] + 1) * (self.t_num_bbox['max_row'] - self.t_num_bbox['min_row'] + 1)
|
|
num_tiles = (self.t_num_bbox['max_col'] - self.t_num_bbox['min_col'] + 1) * (self.t_num_bbox['max_row'] - self.t_num_bbox['min_row'] + 1)
|
|
grass.message(_('Fetching %d tiles with %d x %d pixel size per tile...') % (num_tiles, tile_size['x'], tile_size['y']))
|
|
grass.message(_('Fetching %d tiles with %d x %d pixel size per tile...') % (num_tiles, tile_size['x'], tile_size['y']))
|
|
|
|
|
|
@@ -444,7 +447,7 @@ class WMSRequestMgr(BaseRequestMgr):
|
|
# CRS:84 and CRS:83 are exception (CRS:83 and CRS:27 need to be tested)
|
|
# CRS:84 and CRS:83 are exception (CRS:83 and CRS:27 need to be tested)
|
|
if srs_param in [84, 83] or version != '1.3.0':
|
|
if srs_param in [84, 83] or version != '1.3.0':
|
|
return bbox
|
|
return bbox
|
|
- elif Srs('epsg:' + str(srs_param)).axisorder == 'yx':
|
|
|
|
|
|
+ elif Srs(GetSRSParamVal(srs_param)).axisorder == 'yx':
|
|
return self._flipBbox(bbox)
|
|
return self._flipBbox(bbox)
|
|
|
|
|
|
return bbox
|
|
return bbox
|
|
@@ -505,7 +508,7 @@ class WMTSRequestMgr(BaseRequestMgr):
|
|
mat_num_bbox = self._getMatSize(tile_mat, mat_set_link)
|
|
mat_num_bbox = self._getMatSize(tile_mat, mat_set_link)
|
|
|
|
|
|
# initialize data needed for iteration through tiles
|
|
# initialize data needed for iteration through tiles
|
|
- self._computeRequestData(tile_mat, params, bbox, mat_num_bbox)
|
|
|
|
|
|
+ self._computeRequestData(tile_mat, params, bbox, mat_num_bbox, self._getMatSetSrs(mat_set))
|
|
|
|
|
|
def GetMapRegion(self):
|
|
def GetMapRegion(self):
|
|
"""!Get size in pixels and bounding box of raster where all tiles will be merged.
|
|
"""!Get size in pixels and bounding box of raster where all tiles will be merged.
|
|
@@ -540,8 +543,8 @@ class WMTSRequestMgr(BaseRequestMgr):
|
|
mat_set_id = mat_set.find(self.xml_ns.NsOws('Identifier')).text
|
|
mat_set_id = mat_set.find(self.xml_ns.NsOws('Identifier')).text
|
|
if mat_set_id != mat_set_link_id:
|
|
if mat_set_id != mat_set_link_id:
|
|
continue
|
|
continue
|
|
- mat_set_srs = mat_set.find(self.xml_ns.NsOws('SupportedCRS')).text
|
|
|
|
- if mat_set_srs.lower() == ("EPSG:"+ str(srs)).lower():
|
|
|
|
|
|
+ mat_set_srs = self._getMatSetSrs(mat_set)
|
|
|
|
+ if Srs(mat_set_srs).getcode() == (GetSRSParamVal(srs)).upper():
|
|
suitable_mat_sets.append([mat_set, link])
|
|
suitable_mat_sets.append([mat_set, link])
|
|
|
|
|
|
if not suitable_mat_sets:
|
|
if not suitable_mat_sets:
|
|
@@ -549,6 +552,10 @@ class WMTSRequestMgr(BaseRequestMgr):
|
|
|
|
|
|
return suitable_mat_sets # [[TileMatrixSet, TileMatrixSetLink], ....]
|
|
return suitable_mat_sets # [[TileMatrixSet, TileMatrixSetLink], ....]
|
|
|
|
|
|
|
|
+ def _getMatSetSrs(self, mat_set):
|
|
|
|
+
|
|
|
|
+ return mat_set.find(self.xml_ns.NsOws('SupportedCRS')).text
|
|
|
|
+
|
|
def _findTileMats(self, tile_mats, region, bbox):
|
|
def _findTileMats(self, tile_mats, region, bbox):
|
|
"""!Find best tile matrix set for requested resolution.
|
|
"""!Find best tile matrix set for requested resolution.
|
|
"""
|
|
"""
|
|
@@ -638,7 +645,7 @@ class WMTSRequestMgr(BaseRequestMgr):
|
|
break
|
|
break
|
|
return mat_num_bbox
|
|
return mat_num_bbox
|
|
|
|
|
|
- def _computeRequestData(self, tile_mat, params, bbox, mat_num_bbox):
|
|
|
|
|
|
+ def _computeRequestData(self, tile_mat, params, bbox, mat_num_bbox, mat_set_srs):
|
|
"""!Initialize data needed for iteration through tiles.
|
|
"""!Initialize data needed for iteration through tiles.
|
|
"""
|
|
"""
|
|
scale_den = float(tile_mat.find(self.xml_ns.NsWmts('ScaleDenominator')).text)
|
|
scale_den = float(tile_mat.find(self.xml_ns.NsWmts('ScaleDenominator')).text)
|
|
@@ -651,6 +658,15 @@ class WMTSRequestMgr(BaseRequestMgr):
|
|
tl_corner['minx'] = float(tl_str[0])
|
|
tl_corner['minx'] = float(tl_str[0])
|
|
tl_corner['maxy'] = float(tl_str[1])
|
|
tl_corner['maxy'] = float(tl_str[1])
|
|
|
|
|
|
|
|
+ #TODO do it more generally WMS cap parser may use it in future(not needed now)???
|
|
|
|
+ s = Srs(mat_set_srs) #NOTE not used params['srs'], it is just number, encoding needed
|
|
|
|
+ # TODO needs to be tested, tried only on http://www.landesvermessung.sachsen.de/geoserver/gwc/service/wmts?:
|
|
|
|
+ if s.getcode() == 'EPSG:4326' and s.encoding in ('uri', 'urn'):
|
|
|
|
+ grass.warning('switch')
|
|
|
|
+ (tl_corner['minx'], tl_corner['maxy']) = (tl_corner['maxy'], tl_corner['minx'])
|
|
|
|
+ else:
|
|
|
|
+ grass.warning('no switch')
|
|
|
|
+
|
|
tile_span = {}
|
|
tile_span = {}
|
|
self.tile_size = {}
|
|
self.tile_size = {}
|
|
|
|
|