I have made some edits in your script. I changed the For cycle into Copy Layer method. Try it if you want. This method preserve the attributes as you want. import ogr,os,sys Datasource_Parks = 'ArcCR500_v32/ChranenaUzemi.shp' Direction_Result_Shp = 'ArcCR500_v32/Result.shp' Direction_Result_Dbf="ArcCR500_v32/Table.dbf" Open_Parks = ogr.Open(Datasource_Parks) layer_park = Open_Parks.GetLayer(0) SQL = "NAZEV_ASCI = 'Krkonossky narodni park'" layer_park.SetAttributeFilter(SQL) Number_Of_Park = layer_park.GetFeatureCount() ####################################################### edit driver_out = ogr.GetDriverByName("ESRI Shapefile") ds_out = driver_out.CreateDataSource("output_file.shp") lyr_out = ds_out.CopyLayer(layer_park, "output_file") lyr_out.SyncToDisk() ds_out.SyncToDisk() ####################################################### end Dataset.Destroy()