예제 #1
0
 def handleAlgorithmResults(alg, progress, showResults = True):
     wrongLayers = []
     htmlResults = False;
     progress.setText("Loading resulting layers")
     i =  0
     for out in alg.outputs:
         progress.setPercentage(100 * i / float(len(alg.outputs)))
         if out.hidden or not out.open:
             continue
         if isinstance(out, (OutputRaster, OutputVector, OutputTable)):
             try:
                 if out.value.startswith("memory:"):
                     layer = out.memoryLayer
                     QgsMapLayerRegistry.instance().addMapLayers([layer])
                 else:
                     if ProcessingConfig.getSetting(ProcessingConfig.USE_FILENAME_AS_LAYER_NAME):
                         name = os.path.basename(out.value)
                     else:
                         name = out.description
                     QGisLayers.load(out.value, name, alg.crs, RenderingStyles.getStyle(alg.commandLineName(),out.name))
             except Exception, e:
                 wrongLayers.append(out)
                 #QMessageBox.critical(None, "Error", str(e))
         elif isinstance(out, OutputHTML):
             ProcessingResults.addResult(out.description, out.value)
             htmlResults = True
예제 #2
0
def load(path):
    """Loads a layer into QGIS"""
    return QGisLayers.load(path)
예제 #3
0
def loadTestData():
    QGisLayers.load(points(), "points")
    QGisLayers.load(points2(), "points2")
    QGisLayers.load(polygons(), "polygons")
    QGisLayers.load(polygons2(), "polygons2")
    QGisLayers.load(polygonsGeoJson(), "polygonsGeoJson")
    QGisLayers.load(lines(), "lines")
    QGisLayers.load(raster(), "raster")
    QGisLayers.load(table(), "table")
    QGisLayers.load(union(), "union")
예제 #4
0
def load(path):
    '''Loads a layer into QGIS'''
    return QGisLayers.load(path)
예제 #5
0
def loadTestData():
    QGisLayers.load(points(), "points")
    QGisLayers.load(points2(), "points2")
    QGisLayers.load(polygons(), "polygons")
    QGisLayers.load(polygons2(), "polygons2")
    QGisLayers.load(polygonsGeoJson(), "polygonsGeoJson")
    QGisLayers.load(lines(), "lines")
    QGisLayers.load(raster(), "raster")
    QGisLayers.load(table(), "table")
    QGisLayers.load(union(), "union")