Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parameters = {'INPUT': QgsProcessingFeatureSourceDefinition(layer1.id(), True),
- 'OVERLAY': QgsProcessingFeatureSourceDefinition(layer2.id(), True),
- 'OUTPUT': 'memory:'}
- differenced = processing.run('qgis:difference', parameters)
- QgsProject.instance().addMapLayer(layer1, False)
- QgsProject.instance().addMapLayer(layer2, False)
- diff = processing.runalg("qgis:difference", layer1, layer2, False, None)
- result = processing.getObject(diff['OUTPUT'])
- # if you want to save it to file
- _writer = QgsVectorFileWriter.writeAsVectorFormat(result, 'output_layer.shp', "utf-8", None, "ESRI Shapefile")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement