def checkSagaIsInstalled(ignoreRegistrySettings=False): if SextanteUtils.isWindows(): path = SagaUtils.sagaPath() if path == "": return "SAGA folder is not configured.\nPlease configure it before running SAGA algorithms." cmdpath = os.path.join(path, "saga_cmd.exe") if not os.path.exists(cmdpath): return ("The specified SAGA folder does not contain a valid SAGA executable.\n" + "Please, go to the SEXTANTE settings dialog, and check that the SAGA\n" + "folder is correctly configured") settings = QSettings() if not ignoreRegistrySettings: SAGA_INSTALLED = "/SextanteQGIS/SagaInstalled" if settings.contains(SAGA_INSTALLED): return try: from sextante.core.Sextante import runalg result = runalg("saga:thiessenpolygons", points(), None) if not os.path.exists(result['POLYGONS']): return "It seems that SAGA is not correctly installed in your system.\nPlease install it before running SAGA algorithms." except: s = traceback.format_exc() return "Error while checking SAGA installation. SAGA might not be correctly configured.\n" + s; settings.setValue(SAGA_INSTALLED, True)
def checkGrassIsInstalled(ignoreRegistrySettings=False): if SextanteUtils.isWindows(): path = GrassUtils.grassPath() if path == "": return "GRASS folder is not configured.\nPlease configure it before running SAGA algorithms." cmdpath = os.path.join(path, "bin\r.out.exe") if not os.path.exists(cmdpath): return ("The specified GRASS folder does not contain a valid set of GRASS modules.\n" + "Please, go to the SEXTANTE settings dialog, and check that the GRASS\n" + "folder is correctly configured") settings = QSettings() if not ignoreRegistrySettings: GRASS_INSTALLED = "/SextanteQGIS/GrassInstalled" if settings.contains(GRASS_INSTALLED): return try: from sextante.core.Sextante import runalg result = runalg("grass:v.voronoi", points(),False,False,"270778.60198,270855.745301,4458921.97814,4458983.8488",-1,0.0001,None) if not os.path.exists(result['output']): return "It seems that GRASS is not correctly installed and configured in your system.\nPlease install it before running GRASS algorithms." except: s = traceback.format_exc() return "Error while checking GRASS installation. GRASS might not be correctly configured.\n" + s; settings.setValue(GRASS_INSTALLED, True)
def checkGrassIsInstalled(ignoreRegistrySettings=False): if SextanteUtils.isWindows(): path = GrassUtils.grassPath() if path == "": return "GRASS folder is not configured.\nPlease configure it before running SAGA algorithms." cmdpath = os.path.join(path, "bin\r.out.exe") if not os.path.exists(cmdpath): return ( "The specified GRASS folder does not contain a valid set of GRASS modules.\n" + "Please, go to the SEXTANTE settings dialog, and check that the GRASS\n" + "folder is correctly configured") settings = QSettings() if not ignoreRegistrySettings: GRASS_INSTALLED = "/SextanteQGIS/GrassInstalled" if settings.contains(GRASS_INSTALLED): return try: from sextante.core.Sextante import runalg result = runalg( "grass:v.voronoi", points(), False, False, "270778.60198,270855.745301,4458921.97814,4458983.8488", -1, 0.0001, None) if not os.path.exists(result['output']): return "It seems that GRASS is not correctly installed and configured in your system.\nPlease install it before running GRASS algorithms." except: s = traceback.format_exc() return "Error while checking GRASS installation. GRASS might not be correctly configured.\n" + s settings.setValue(GRASS_INSTALLED, True)
def checkSagaIsInstalled(ignoreRegistrySettings=False): if SextanteUtils.isWindows(): path = SagaUtils.sagaPath() if path == "": return "SAGA folder is not configured.\nPlease configure it before running SAGA algorithms." cmdpath = os.path.join(path, "saga_cmd.exe") if not os.path.exists(cmdpath): return ( "The specified SAGA folder does not contain a valid SAGA executable.\n" + "Please, go to the SEXTANTE settings dialog, and check that the SAGA\n" + "folder is correctly configured") settings = QSettings() if not ignoreRegistrySettings: SAGA_INSTALLED = "/SextanteQGIS/SagaInstalled" if settings.contains(SAGA_INSTALLED): return try: from sextante.core.Sextante import runalg result = runalg("saga:thiessenpolygons", points(), None) if not os.path.exists(result['POLYGONS']): return "It seems that SAGA is not correctly installed in your system.\nPlease install it before running SAGA algorithms." except: s = traceback.format_exc() return "Error while checking SAGA installation. SAGA might not be correctly configured.\n" + s settings.setValue(SAGA_INSTALLED, True)
def checkSagaIsInstalled(cls): if SextanteUtils.isWindows(): path = SagaUtils.sagaPath() if path == "": return "SAGA folder is not configured.\nPlease configure it before running SAGA algorithms." cmdpath = os.path.join(path, "saga_cmd.exe") if not os.path.exists(cmdpath): return ("The specified SAGA folder does not contain a valid SAGA executable.\n" + "Please, go to the SEXTANTE settings dialog, and check that the SAGA\n" + "folder is correctly configured") SAGA_INSTALLED = "/SextanteQGIS/SagaInstalled" settings = QSettings() if settings.contains(SAGA_INSTALLED): return try: qgis = QGisLayers.iface crs = qgis.mapCanvas().mapRenderer().destinationCrs() fields = [] fields.append(QgsField("NUM_FIELD", QVariant.Int)) filename = SextanteUtils.getTempFilename("shp") writer = SextanteVectorWriter(filename, None, fields, QGis.WKBPoint, crs) for x in range(5): for y in range(5): attrs = [] attrs.append(QVariant(x)) outFeat = QgsFeature() pt = QgsPoint(x, y) outFeat.setGeometry(QgsGeometry.fromPoint(pt)) outFeat.setAttributes(attrs) writer.addFeature(outFeat) del writer.writer del writer from sextante.core.Sextante import runalg result = runalg("saga:thiessenpolygons", filename, None) if not os.path.exists(result['POLYGONS']): return "It seems that SAGA is not correctly installed in your system.\nPlease install it before running SAGA algorithms." except: s = traceback.format_exc() return "Error while checking SAGA installation. SAGA might not be correctly configured.\n" + s; settings.setValue("/SextanteQGIS/SagaInstalled", True)