[GRASS-SVN] r56519 - grass/trunk/scripts/r.in.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 31 05:49:21 PDT 2013
Author: turek
Date: 2013-05-31 05:49:20 -0700 (Fri, 31 May 2013)
New Revision: 56519
Modified:
grass/trunk/scripts/r.in.wms/wms_base.py
grass/trunk/scripts/r.in.wms/wms_drv.py
Log:
r.in.wms: url fix
Modified: grass/trunk/scripts/r.in.wms/wms_base.py
===================================================================
--- grass/trunk/scripts/r.in.wms/wms_base.py 2013-05-31 12:47:55 UTC (rev 56518)
+++ grass/trunk/scripts/r.in.wms/wms_base.py 2013-05-31 12:49:20 UTC (rev 56519)
@@ -195,12 +195,17 @@
"""
cap_url = options['url']
+ if "?" in cap_url:
+ cap_url += "&"
+ else:
+ cap_url += "?"
+
if 'WMTS' in options['driver']:
- cap_url += "?SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0"
+ cap_url += "SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0"
elif 'OnEarth' in options['driver']:
- cap_url += "?REQUEST=GetTileService"
+ cap_url += "REQUEST=GetTileService"
else:
- cap_url += "?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=" + options['wms_version']
+ cap_url += "SERVICE=WMS&REQUEST=GetCapabilities&VERSION=" + options['wms_version']
grass.debug('Fetching capabilities file.\n%s' % cap_url)
try:
cap = self._fetchDataFromServer(cap_url, options['username'], options['password'])
Modified: grass/trunk/scripts/r.in.wms/wms_drv.py
===================================================================
--- grass/trunk/scripts/r.in.wms/wms_drv.py 2013-05-31 12:47:55 UTC (rev 56518)
+++ grass/trunk/scripts/r.in.wms/wms_drv.py 2013-05-31 12:49:20 UTC (rev 56519)
@@ -47,6 +47,11 @@
"""
grass.message(_("Downloading data from WMS server..."))
+ if "?" in self.params["url"]:
+ self.params["url"] += "&"
+ else:
+ self.params["url"] += "?"
+
if not self.params['capfile']:
self.cap_file = self._fetchCapabilities(self.params)
else:
@@ -307,7 +312,7 @@
"""
self.version = params['wms_version']
proj = params['proj_name'] + "=EPSG:"+ str(params['srs'])
- self.url = params['url'] + ("?SERVICE=WMS&REQUEST=GetMap&VERSION=%s&LAYERS=%s&WIDTH=%s&HEIGHT=%s&STYLES=%s&BGCOLOR=%s&TRANSPARENT=%s" % \
+ self.url = params['url'] + ("SERVICE=WMS&REQUEST=GetMap&VERSION=%s&LAYERS=%s&WIDTH=%s&HEIGHT=%s&STYLES=%s&BGCOLOR=%s&TRANSPARENT=%s" % \
(params['wms_version'], params['layers'], tile_size['cols'], tile_size['rows'], params['styles'], \
params['bgcolor'], params['transparent']))
self.url += "&" +proj+ "&" + "FORMAT=" + params['format']
@@ -617,7 +622,7 @@
self.tile_size['y'] = int(tile_mat.find(self.xml_ns.NsWmts('TileHeight')).text)
tile_span['y'] = pixel_span * self.tile_size['y']
- self.url = params['url'] + ("?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&" \
+ self.url = params['url'] + ("SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&" \
"LAYER=%s&STYLE=%s&FORMAT=%s&TILEMATRIXSET=%s&TILEMATRIX=%s" % \
(params['layers'], params['styles'], params['format'],
params['tile_matrix_set'], tile_mat.find(self.xml_ns.NsOws('Identifier')).text ))
@@ -659,7 +664,7 @@
# parse tile service file and get needed data for making tile requests
url, self.tile_span, t_patt_bbox, self.tile_size = self._parseTileService(root, bbox, region, params)
self.url = url
- self.url[0] = params['url'] + '?' + url[0]
+ self.url[0] = params['url'] + url[0]
# initialize data needed for iteration through tiles
self._computeRequestData(bbox, t_patt_bbox, self.tile_span, self.tile_size)
More information about the grass-commit
mailing list