QgsVectorFileWriter.writeAsVectorFormat(poly_lyr, f'{path}\\tryfile', 'utf-8', QgsCoordinateReferenceSystem('EPSG:4326'), 'GeoJSON', layerOptions=['COORDINATE_PRECISION=8'], onlySelected=True)
QgsVectorFileWriter.writeAsVectorFormat(line_lyr, f'{path}\\tryfile', 'utf-8', QgsCoordinateReferenceSystem('EPSG:4326'), 'GeoJSON', layerOptions=['COORDINATE_PRECISION=8'])
I am using these two lines respectively but it makes overwrite. I'd like to append the second layer too to the tryfile.geojson
after the first one. Is that possible and what is the easiest way?