[GRASS-SVN] r51363 - grass-addons/grass7/raster/r.in.wms2
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 10 15:12:49 EDT 2012
Author: martinl
Date: 2012-04-10 12:12:48 -0700 (Tue, 10 Apr 2012)
New Revision: 51363
Modified:
grass-addons/grass7/raster/r.in.wms2/r.in.wms2.py
grass-addons/grass7/raster/r.in.wms2/wms_base.py
Log:
r.in.wms2: don't call GetCapabilities/GetMap in base class constructor
Modified: grass-addons/grass7/raster/r.in.wms2/r.in.wms2.py
===================================================================
--- grass-addons/grass7/raster/r.in.wms2/r.in.wms2.py 2012-04-10 19:00:15 UTC (rev 51362)
+++ grass-addons/grass7/raster/r.in.wms2/r.in.wms2.py 2012-04-10 19:12:48 UTC (rev 51363)
@@ -143,14 +143,17 @@
if flags['d']:
grass.debug("Using own driver")
from wms_drv import WMSDrv
- wms = WMSDrv(options, flags)
+ wms = WMSDrv()
else:
grass.debug("Using GDAL WMS driver")
from wms_gdal_drv import WMSGdalDrv
- wms = WMSGdalDrv(options, flags)
-
-
+ wms = WMSGdalDrv()
+ if flags['c']:
+ wms.GetCapabilities(options)
+ else:
+ wms.GetMap(options, flags)
+
return 0
if __name__ == "__main__":
Modified: grass-addons/grass7/raster/r.in.wms2/wms_base.py
===================================================================
--- grass-addons/grass7/raster/r.in.wms2/wms_base.py 2012-04-10 19:00:15 UTC (rev 51362)
+++ grass-addons/grass7/raster/r.in.wms2/wms_base.py 2012-04-10 19:12:48 UTC (rev 51363)
@@ -7,32 +7,15 @@
import grass.script as grass
class WMSBase:
- def __init__(self, options, flags):
+ def __init__(self):
# these variables are information for destructor
self.temp_files_to_cleanup = []
- self.cleanup_mask = False
+ self.cleanup_mask = False
self.cleanup_layers = False
self.bbox = None
self.temp_map = None
- if flags['c']:
- self._getCapabilities(options)
- else:
- self._getMap(options, flags)
-
- def _getMap(self, options, flags):
- """!Download data from WMS server and import data
- (using GDAL library) into GRASS as a raster map."""
-
- self._initializeParameters(options, flags)
-
- self.bbox = self._computeBbox()
-
- self.temp_map = self._download()
-
- self._createOutputMap()
-
def __del__(self):
# removes temporary mask, used for import transparent or warped temp_map
if self.cleanup_mask:
@@ -185,8 +168,20 @@
self.gdal_drv_format = "GTiff"
self._debug("_initialize_parameters", "finished")
+
+ def GetMap(self, options, flags):
+ """!Download data from WMS server and import data
+ (using GDAL library) into GRASS as a raster map."""
+
+ self._initializeParameters(options, flags)
+
+ self.bbox = self._computeBbox()
- def _getCapabilities(self, options):
+ self.temp_map = self._download()
+
+ self._createOutputMap()
+
+ def GetCapabilities(self, options):
"""!Get capabilities from WMS server
"""
# download capabilities file
More information about the grass-commit
mailing list