def __init__(self, cwd=None, env=None, stdout_handler=None, stderr_handler=None): ''' :param cwd: program working directory :param env: environment dictionary :param envmerge: if set to True (default) it is the :attr:`env` dictionaty is used to update the system environment :param stdout_handler: *OutputHandler* for the stdout of the tool :param stderr_handler: *OutputHandler* for the stderr of the tool .. seealso:: :class:`exectools.BaseOutputHandler` ''' executable = utils.which('gsdstats') if executable: cmd = utils.scriptcmd(executable) else: cmd = _gsdtoolcmd('stats') super(StatsDescriptor, self).__init__(cmd, [], cwd, env, stdout_handler, stderr_handler) #: Disable statistics computation (default: False) self.nostats = None #: Compute statistics for a specific raster band. #: #: Default: all bands are precessed. self.band = None #: Allow approximate statistics computation. #: #: If set then statistics may be computed based on overviews or a #: subset of all tiles (default: False) self.approxok = None #: Only print minimum and maximum on the same line self.minmaxonly = None #: Specify source window in image coordinates. #: #: Default: the entire image is processed. self.srcwin = None #: Write results to FILE. self.outfile = None #: Suppress progress messages. self.quiet = False self._histreq = HistogramRequest() self._histreq.computehistogram = False
def __init__(self, cwd=None, env=None, stdout_handler=None, stderr_handler=None): ''' :param cwd: program working directory :param env: environment dictionary :param envmerge: if set to True (default) it is the :attr:`env` dictionaty is used to update the system environment :param stdout_handler: *OutputHandler* for the stdout of the tool :param stderr_handler: *OutputHandler* for the stderr of the tool .. seealso:: :class:`exectools.BaseOutputHandler` ''' executable = utils.which('gsdstats') if executable: cmd = utils.scriptcmd(executable) else: cmd = _gsdtoolcmd('stats') super(StatsDescriptor, self).__init__( cmd, [], cwd, env, stdout_handler, stderr_handler) #: Disable statistics computation (default: False) self.nostats = None #: Compute statistics for a specific raster band. #: #: Default: all bands are precessed. self.band = None #: Allow approximate statistics computation. #: #: If set then statistics may be computed based on overviews or a #: subset of all tiles (default: False) self.approxok = None #: Only print minimum and maximum on the same line self.minmaxonly = None #: Specify source window in image coordinates. #: #: Default: the entire image is processed. self.srcwin = None #: Write results to FILE. self.outfile = None #: Suppress progress messages. self.quiet = False self._histreq = HistogramRequest() self._histreq.computehistogram = False
def loadSettings(self, settings): settings.beginGroup('plugins/%s' % info.name) try: googleearth = settings.value('gogle_earth_path') if not googleearth: if sys.platform.startswith('win'): googleearth = utils.which('googleearth.exe') else: for name in ('googleearth', 'google-earth'): googleearth = utils.which(name) if googleearth: break action = self.actions.findChild(QtGui.QAction, 'openInGoogleEarthAction') if googleearth: self.googleearth = googleearth action.setEnabled(True) else: self.googleearth = None action.setEnabled(False) finally: settings.endGroup()
def __init__(self, cwd=None, env=None, stdout_handler=None, stderr_handler=None): ''' :param cwd: program working directory :param env: environment dictionary :param envmerge: if set to True (default) it is the :attr:`env` dictionaty is used to update the system environment :param stdout_handler: *OutputHandler* for the stdout of the tool :param stderr_handler: +OutputHandler* for the stderr of the tool .. seealso:: :class:`exectools.BaseOutputHandler` ''' executable = utils.which('ras2vec') if executable: cmd = utils.scriptcmd(executable) else: cmd = _gsdtoolcmd('ras2vec') super(Ras2vecDescriptor, self).__init__(cmd, [], cwd, env, stdout_handler, stderr_handler) #: Generate an additional layer for GCPs. self.gcps = None #: Generate markers for bounding box corners. self.corners = None #: Store absolute path in bounding box feature description. self.abspath = None
def __init__(self, cwd=None, env=None, stdout_handler=None, stderr_handler=None): ''' :param cwd: program working directory :param env: environment dictionary :param envmerge: if set to True (default) it is the :attr:`env` dictionaty is used to update the system environment :param stdout_handler: *OutputHandler* for the stdout of the tool :param stderr_handler: +OutputHandler* for the stderr of the tool .. seealso:: :class:`exectools.BaseOutputHandler` ''' executable = utils.which('ras2vec') if executable: cmd = utils.scriptcmd(executable) else: cmd = _gsdtoolcmd('ras2vec') super(Ras2vecDescriptor, self).__init__( cmd, [], cwd, env, stdout_handler, stderr_handler) #: Generate an additional layer for GCPs. self.gcps = None #: Generate markers for bounding box corners. self.corners = None #: Store absolute path in bounding box feature description. self.abspath = None
def init(app): import os import sys import logging from osgeo import gdal from gsdview import utils from gsdview import qtsupport from gsdview.gdalbackend import widgets from gsdview.gdalbackend import gdalsupport _log = logging.getLogger(__name__) # @TODO: check #UseExceptions() # set file dialog filters app.filedialog.setNameFilters(gdalsupport.gdalFilters()) # update versions info in about dialog app.aboutdialog.addSoftwareVersion('GDAL', gdal.VersionInfo('RELEASE_NAME'), 'http://www.gdal.org') # GDAL icon icon = qtsupport.geticon('GDALLogoColor.svg', __name__) # update the settings dialog #page = widgets.GDALPreferencesPage(app.preferencesdialog) page = widgets.BackendPreferencesPage(app.preferencesdialog) app.preferencesdialog.addPage(page, icon, 'GDAL') # add a new page in the about dialog page = widgets.GDALInfoWidget(app.aboutdialog) tabindex = app.aboutdialog.tabWidget.addTab(page, icon, 'GDAL') widget = app.aboutdialog.tabWidget.widget(tabindex) widget.setObjectName('gdalTab') # @TODO: check # register the backend app.backends.append(name) global _backendobj _backendobj = GDALBackend(app) # @TODO: fix #~ gdal.SetConfigOption('GDAL_PAM_ENABLED', 'YES') #~ gdal.SetConfigOption('GDAL_PAM_PROXY_DIR', #~ os.path.expanduser(os.path.join('~', '.gsdview', #~ 'cache'))) # @TODO: fix # @NOTE: explicitly disable GDAL exceptions due to bug #3077 # (http://trac.osgeo.org/gdal/ticket/3077) #UseExceptions() DontUseExceptions() # Fix path for GDAL tools if getattr(sys, 'frozen', False): from gsdview import appsite os.environ['PATH'] = os.pathsep.join( (appsite.GSDVIEWROOT, os.getenv('PATH', ''))) gdal.SetConfigOption('GDAL_DATA', os.path.join(appsite.GSDVIEWROOT, 'data')) # @TODO: check #if app.settings.value('GDAL_DATA').isValid(): # msg = app.tr('"GDAL_DATA" from the user configuration file ' # 'overrides the default value') # QtWidgets.QMessageBox.warning(app, app.tr('WARNING'), msg) elif sys.platform == 'darwin': gdaladdobin = utils.which('gdaladdo') if not gdaladdobin: frameworkroot = os.path.join(os.path.dirname(gdal.__file__), os.pardir, os.pardir, os.pardir) frameworkroot = os.path.abspath(frameworkroot) binpath = os.path.join(frameworkroot, 'unix', 'bin') PATH = os.getenv('PATH', '') if binpath not in PATH: PATH = os.pathsep.join((binpath, PATH)) os.environ['PATH'] = PATH _log.info('GDAL binary path added to system path: %s', binpath) #elif sys.platform[:3] == 'win': # gdaladdobin = utils.which('gdaladdo') # if not gdaladdobin: # pass return _backendobj
def init(app): import os import sys import logging from osgeo import gdal from gsdview import utils from gsdview import qtsupport from gsdview.gdalbackend import widgets from gsdview.gdalbackend import gdalsupport _log = logging.getLogger(__name__) # @TODO: check #UseExceptions() # set file dialog filters app.filedialog.setNameFilters(gdalsupport.gdalFilters()) # update versions info in about dialog app.aboutdialog.addSoftwareVersion( 'GDAL', gdal.VersionInfo('RELEASE_NAME'), 'http://www.gdal.org') # GDAL icon icon = qtsupport.geticon('GDALLogoColor.svg', __name__) # update the settings dialog #page = widgets.GDALPreferencesPage(app.preferencesdialog) page = widgets.BackendPreferencesPage(app.preferencesdialog) app.preferencesdialog.addPage(page, icon, 'GDAL') # add a new page in the about dialog page = widgets.GDALInfoWidget(app.aboutdialog) tabindex = app.aboutdialog.tabWidget.addTab(page, icon, 'GDAL') widget = app.aboutdialog.tabWidget.widget(tabindex) widget.setObjectName('gdalTab') # @TODO: check # register the backend app.backends.append(name) global _backendobj _backendobj = GDALBackend(app) # @TODO: fix #~ gdal.SetConfigOption('GDAL_PAM_ENABLED', 'YES') #~ gdal.SetConfigOption('GDAL_PAM_PROXY_DIR', #~ os.path.expanduser(os.path.join('~', '.gsdview', #~ 'cache'))) # @TODO: fix # @NOTE: explicitly disable GDAL exceptions due to bug #3077 # (http://trac.osgeo.org/gdal/ticket/3077) #UseExceptions() DontUseExceptions() # Fix path for GDAL tools if getattr(sys, 'frozen', False): from gsdview import appsite os.environ['PATH'] = os.pathsep.join((appsite.GSDVIEWROOT, os.getenv('PATH', ''))) gdal.SetConfigOption('GDAL_DATA', os.path.join(appsite.GSDVIEWROOT, 'data')) # @TODO: check #if app.settings.value('GDAL_DATA').isValid(): # msg = app.tr('"GDAL_DATA" from the user configuration file ' # 'overrides the default value') # QtWidgets.QMessageBox.warning(app, app.tr('WARNING'), msg) elif sys.platform == 'darwin': gdaladdobin = utils.which('gdaladdo') if not gdaladdobin: frameworkroot = os.path.join(os.path.dirname(gdal.__file__), os.pardir, os.pardir, os.pardir) frameworkroot = os.path.abspath(frameworkroot) binpath = os.path.join(frameworkroot, 'unix', 'bin') PATH = os.getenv('PATH', '') if binpath not in PATH: PATH = os.pathsep.join((binpath, PATH)) os.environ['PATH'] = PATH _log.info('GDAL binary path added to system path: %s', binpath) #elif sys.platform[:3] == 'win': # gdaladdobin = utils.which('gdaladdo') # if not gdaladdobin: # pass return _backendobj