[FOSSGIS-Talk] Objekte aus Layer entfernen und in neuem Layer speichern

Claas Leiner claas.leiner at gkg-kassel.de
Do Jan 26 09:10:10 CET 2017


Hallo Eckhard,

ich habe auf die Schnelle zwei Modelle gebaut mit denen man das umsetzen 
kann. Version 1 ist schneller, funktioniert aber nicht bei NULL-Werten 
in der Spalte.
Bei Version 2 werden zu löschenden features über eine räumliche Auswahl 
gewählt, die Variante funktioniert nur mit Polygonen.

Einfach nach Benutzerverzeichnis/.qgis2/processing/modelle kopieren. 
Werkzeuge sind dann unter Modelle > tabellentools verfügbar.

Wenn man für das Ergebnis "gelöscht"  den Eingabelayer verwendet, wird 
direkt in der Ausgangsdatei gelöscht. Das direkte Schreiben in die 
Ausgangsdatei funktioniert bei Shapes unter Linux jedoch nicht unter 
Windows. Unter Windows geht es jedoch z.B. mit dem Format geojson. 
Ansonsten einfach zwei neue Layer erzeugen.

Viele Grüße,

Claas
-- 
-----------------------------------------
GKG-Kassel - Dr.-Ing. Claas Leiner
QGIS-Support und mehr

Geodatenservice, Kartenwerkstatt &
GIS-Schule Kassel

Wilhelmshöher Allee 304 E
34131 Kassel
Tel. 0561/56013445
claas.leiner at gkg-kassel.de
----------------------------------------
http://www.gkg-kassel.de
----------------------------------------
Unterstützen Sie QGIS
QGIS-DE e.V. | http://qgis.de
QGIS Projekt | http://qgis.org/de/site/
-------------- nächster Teil --------------
{
    "values": {
        "inputs": {
            "eingabe": {
                "values": {
                    "pos": {
                        "values": {
                            "y": 60.0, 
                            "x": 120.0
                        }, 
                        "class": "point"
                    }, 
                    "param": {
                        "values": {
                            "isAdvanced": false, 
                            "name": "eingabe", 
                            "shapetype": [
                                -1
                            ], 
                            "default": null, 
                            "value": null, 
                            "exported": null, 
                            "hidden": false, 
                            "optional": false, 
                            "description": "Layer"
                        }, 
                        "class": "processing.core.parameters.ParameterVector"
                    }
                }, 
                "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
            }, 
            "spalte": {
                "values": {
                    "pos": {
                        "values": {
                            "y": 60.0, 
                            "x": 340.0
                        }, 
                        "class": "point"
                    }, 
                    "param": {
                        "values": {
                            "isAdvanced": false, 
                            "name": "spalte", 
                            "parent": "eingabe", 
                            "default": null, 
                            "value": null, 
                            "datatype": -1, 
                            "hidden": false, 
                            "optional": false, 
                            "description": "Spalte"
                        }, 
                        "class": "processing.core.parameters.ParameterTableField"
                    }
                }, 
                "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
            }, 
            "wert": {
                "values": {
                    "pos": {
                        "values": {
                            "y": 60.0, 
                            "x": 560.0
                        }, 
                        "class": "point"
                    }, 
                    "param": {
                        "values": {
                            "isAdvanced": false, 
                            "name": "wert", 
                            "default": "", 
                            "value": "", 
                            "multiline": false, 
                            "evaluateExpressions": false, 
                            "hidden": false, 
                            "optional": false, 
                            "description": "Wert"
                        }, 
                        "class": "processing.core.parameters.ParameterString"
                    }
                }, 
                "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
            }
        }, 
        "helpContent": {}, 
        "group": "tabellentools", 
        "name": "auswahl loeschen und speichern", 
        "algs": {
            "QGISSAVESELECTEDFEATURES_2": {
                "values": {
                    "name": "QGISSAVESELECTEDFEATURES_2", 
                    "paramsFolded": true, 
                    "outputs": {
                        "OUTPUT_LAYER": {
                            "values": {
                                "description": "geloescht", 
                                "pos": {
                                    "values": {
                                        "y": 470.0, 
                                        "x": 1132.0
                                    }, 
                                    "class": "point"
                                }
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ModelerOutput"
                        }
                    }, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 398.0, 
                            "x": 1096.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "INPUT_LAYER": {
                            "values": {
                                "alg": "QGISSELECTBYATTRIBUTE_2", 
                                "output": "OUTPUT"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:saveselectedfeatures", 
                    "description": "Save selected features"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISSELECTBYATTRIBUTE_2": {
                "values": {
                    "name": "QGISSELECTBYATTRIBUTE_2", 
                    "paramsFolded": true, 
                    "outputs": {}, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 321.0, 
                            "x": 873.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [
                        "QGISSAVESELECTEDFEATURES_1"
                    ], 
                    "params": {
                        "OPERATOR": 1, 
                        "INPUT": {
                            "values": {
                                "name": "eingabe"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "VALUE": {
                            "values": {
                                "name": "wert"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "FIELD": {
                            "values": {
                                "name": "spalte"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:selectbyattribute", 
                    "description": "Auswahl trifft nicht zu"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISSELECTBYATTRIBUTE_1": {
                "values": {
                    "name": "QGISSELECTBYATTRIBUTE_1", 
                    "paramsFolded": true, 
                    "outputs": {}, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 303.0, 
                            "x": 393.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "OPERATOR": 0, 
                        "INPUT": {
                            "values": {
                                "name": "eingabe"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "VALUE": {
                            "values": {
                                "name": "wert"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "FIELD": {
                            "values": {
                                "name": "spalte"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:selectbyattribute", 
                    "description": "Auswahl trifft zu"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISSAVESELECTEDFEATURES_1": {
                "values": {
                    "name": "QGISSAVESELECTEDFEATURES_1", 
                    "paramsFolded": true, 
                    "outputs": {
                        "OUTPUT_LAYER": {
                            "values": {
                                "description": "auswahl", 
                                "pos": {
                                    "values": {
                                        "y": 602.0, 
                                        "x": 578.0
                                    }, 
                                    "class": "point"
                                }
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ModelerOutput"
                        }
                    }, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 443.0, 
                            "x": 428.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "INPUT_LAYER": {
                            "values": {
                                "alg": "QGISSELECTBYATTRIBUTE_1", 
                                "output": "OUTPUT"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:saveselectedfeatures", 
                    "description": "Auswahl speichern"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }
        }
    }, 
    "class": "processing.modeler.ModelerAlgorithm.ModelerAlgorithm"
}
-------------- nächster Teil --------------
{
    "values": {
        "inputs": {
            "eingabe": {
                "values": {
                    "pos": {
                        "values": {
                            "y": 60.0, 
                            "x": 120.0
                        }, 
                        "class": "point"
                    }, 
                    "param": {
                        "values": {
                            "isAdvanced": false, 
                            "name": "eingabe", 
                            "shapetype": [
                                -1
                            ], 
                            "default": null, 
                            "value": null, 
                            "exported": null, 
                            "hidden": false, 
                            "optional": false, 
                            "description": "Eingabe"
                        }, 
                        "class": "processing.core.parameters.ParameterVector"
                    }
                }, 
                "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
            }, 
            "spalte": {
                "values": {
                    "pos": {
                        "values": {
                            "y": 60.0, 
                            "x": 340.0
                        }, 
                        "class": "point"
                    }, 
                    "param": {
                        "values": {
                            "isAdvanced": false, 
                            "name": "spalte", 
                            "parent": "eingabe", 
                            "default": null, 
                            "value": null, 
                            "datatype": -1, 
                            "hidden": false, 
                            "optional": false, 
                            "description": "Spalte"
                        }, 
                        "class": "processing.core.parameters.ParameterTableField"
                    }
                }, 
                "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
            }, 
            "wert": {
                "values": {
                    "pos": {
                        "values": {
                            "y": 60.0, 
                            "x": 560.0
                        }, 
                        "class": "point"
                    }, 
                    "param": {
                        "values": {
                            "isAdvanced": false, 
                            "name": "wert", 
                            "default": "", 
                            "value": "", 
                            "multiline": false, 
                            "evaluateExpressions": false, 
                            "hidden": false, 
                            "optional": false, 
                            "description": "Wert"
                        }, 
                        "class": "processing.core.parameters.ParameterString"
                    }
                }, 
                "class": "processing.modeler.ModelerAlgorithm.ModelerParameter"
            }
        }, 
        "helpContent": {}, 
        "group": "tabellentools", 
        "name": "auswahl loeschen und speichern2", 
        "algs": {
            "QGISSELECTBYLOCATION_1": {
                "values": {
                    "name": "QGISSELECTBYLOCATION_1", 
                    "paramsFolded": true, 
                    "outputs": {}, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 688.0, 
                            "x": 309.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "INPUT": {
                            "values": {
                                "name": "eingabe"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "PREDICATE": [
                            "disjoint"
                        ], 
                        "PRECISION": 0.0, 
                        "INTERSECT": {
                            "values": {
                                "alg": "QGISPOINTONSURFACE_1", 
                                "output": "OUTPUT_LAYER"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
                        }, 
                        "METHOD": 0
                    }, 
                    "active": true, 
                    "consoleName": "qgis:selectbylocation", 
                    "description": "Select by location"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISSAVESELECTEDFEATURES_3": {
                "values": {
                    "name": "QGISSAVESELECTEDFEATURES_3", 
                    "paramsFolded": true, 
                    "outputs": {
                        "OUTPUT_LAYER": {
                            "values": {
                                "description": "gel\u00f6scht", 
                                "pos": {
                                    "values": {
                                        "y": 813.0, 
                                        "x": 482.0
                                    }, 
                                    "class": "point"
                                }
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ModelerOutput"
                        }
                    }, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 768.0, 
                            "x": 282.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "INPUT_LAYER": {
                            "values": {
                                "alg": "QGISSELECTBYLOCATION_1", 
                                "output": "OUTPUT"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:saveselectedfeatures", 
                    "description": "Save selected features"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISSELECTBYATTRIBUTE_1": {
                "values": {
                    "name": "QGISSELECTBYATTRIBUTE_1", 
                    "paramsFolded": true, 
                    "outputs": {}, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 289.0, 
                            "x": 476.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "OPERATOR": 0, 
                        "INPUT": {
                            "values": {
                                "name": "eingabe"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "VALUE": {
                            "values": {
                                "name": "wert"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }, 
                        "FIELD": {
                            "values": {
                                "name": "spalte"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromInput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:selectbyattribute", 
                    "description": "Select by attribute"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISSAVESELECTEDFEATURES_1": {
                "values": {
                    "name": "QGISSAVESELECTEDFEATURES_1", 
                    "paramsFolded": true, 
                    "outputs": {
                        "OUTPUT_LAYER": {
                            "values": {
                                "description": "auswahl", 
                                "pos": {
                                    "values": {
                                        "y": 602.0, 
                                        "x": 578.0
                                    }, 
                                    "class": "point"
                                }
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ModelerOutput"
                        }
                    }, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 448.0, 
                            "x": 473.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "INPUT_LAYER": {
                            "values": {
                                "alg": "QGISSELECTBYATTRIBUTE_1", 
                                "output": "OUTPUT"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:saveselectedfeatures", 
                    "description": "Auswahl speichern"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }, 
            "QGISPOINTONSURFACE_1": {
                "values": {
                    "name": "QGISPOINTONSURFACE_1", 
                    "paramsFolded": true, 
                    "outputs": {}, 
                    "outputsFolded": true, 
                    "pos": {
                        "values": {
                            "y": 578.0, 
                            "x": 363.0
                        }, 
                        "class": "point"
                    }, 
                    "dependencies": [], 
                    "params": {
                        "INPUT_LAYER": {
                            "values": {
                                "alg": "QGISSAVESELECTEDFEATURES_1", 
                                "output": "OUTPUT_LAYER"
                            }, 
                            "class": "processing.modeler.ModelerAlgorithm.ValueFromOutput"
                        }
                    }, 
                    "active": true, 
                    "consoleName": "qgis:pointonsurface", 
                    "description": "Point on surface"
                }, 
                "class": "processing.modeler.ModelerAlgorithm.Algorithm"
            }
        }
    }, 
    "class": "processing.modeler.ModelerAlgorithm.ModelerAlgorithm"
}


Mehr Informationen über die Mailingliste FOSSGIS-Talk-Liste