crs = QgsProject.instance().mapLayersByName("Kraje")[0].crs() transform_context = QgsProject.instance().transformContext() save_options = QgsVectorFileWriter.SaveVectorOptions() save_options.driverName = "ESRI Shapefile" save_options.fileEncoding = "UTF-8" fields = QgsFields() fields.append(QgsField("id", QVariant.Int)) fields.append(QgsField("popis", QVariant.String)) writer = QgsVectorFileWriter.create("C:\\Users\\Ucitel\\pokus.shp",fields,QgsWkbTypes.Point,crs,transform_context,save_options) fet1 = QgsFeature() fet1.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(-654632,-1132433))) fet1.setAttributes([1, "prvni"]) fet2 = QgsFeature() fet2.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(-708650,-1022041))) fet2.setAttributes([2, "druhy"]) writer.addFeature(fet1) writer.addFeature(fet2) del writer