def __init__(self, parameters, service, *args, **kwargs): """Constructor initializes the Geoprocessor using :mod:`arcgisscripting` and loops thorugh all the available parameters in the Geoprocessor. Will raise an exception if problems occur with the Geoprocessor. Parameters are intended to be used in subclasses. Parameters: parameters - parameters object holding parameter information """ Tool.__init__(self, parameters) self._backend = 'arcgis' # TODO: handle the ArcGIS versions correctly try: # Inialize the logger for this tool. Logging system must be set up # before doing thishis self.logger = ArcLogger("Zupport.ArcTool", debugging=True) self.logger.debug('[%s] Acquiring geoprocessor' % service) self.gp = get_geoprocessor(10) # Set the scratch workspace explicitly to ESRI default self.gp.ScratchWorkspace = os.path.join(os.path.expanduser('~'), 'AppData', 'Local', 'Temp') except ImportError, e: self.logger.error('ArcGIS not present in the system.') sys.exit(1)
def __init__(self, parameters, service, *args, **kwargs): ArcRasterTool.__init__(self, parameters, service, *args, **kwargs) CalculateRasterGroup.id = CalculateRasterGroup.id + 1 self.name = self.__class__.__name__ # Identifier is a combination of the name and the class counter self.id = (self.name, CalculateRasterGroup.id) self.log = ArcLogger("Zupport.%s" % (self.__class__.__name__), debugging=True) self.service = service self.log.debug(msgInitSuccess)
def __init__(self, parameters, service, *args, **kwargs): ArcTool.__init__(self, parameters, service, *args, **kwargs) MultiConvertRaster.id = MultiConvertRaster.id + 1 self.id = MultiConvertRaster.id self.name = self.__module__.split('.')[-1] self.log = ArcLogger("Zupport.%s" % (self.__class__.__name__), debugging=True) # Tool needs spatial analyst in order to run # TODO: this should be moved to ToolValidator try: self.register_extension('spatial') except LicenseError, e: self.log.error(e) return 1
def __init__(self, parameters, service, *args, **kwargs): ArcTool.__init__(self, parameters, service, *args, **kwargs) DiscrertizeFields.id = DiscrertizeFields.id + 1 self.name = self.__class__.__name__ # Identifier is a combination of the name and the class counter self.id = (self.name, DiscrertizeFields.id) self.log = ArcLogger("Zupport.%s" % (self.__class__.__name__), debugging=True) self.log.debug(msgInitStart) # Tool needs spatial analyst in order to run # TODO: this should be moved to ToolValidator try: self.register_extension('spatial') except LicenseError, e: self.log.error(e) return 1