i have made a new shape fileshapefile from the original shape fileshapefile , and now i want to copy the attribute table from the original shape fileshapefile to the new select shape fileshapefile , but i don't know how to do that , if any one can help me. thanks?
import ogr,os,sys,ogr
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()
Driver = ogr.GetDriverByName("ESRI shapefile")
if os.path.exists(Direction_Result_Shp):
Driver.DeleteDataSource(Direction_Result_Shp)
Dataset = Driver.CreateDataSource(Direction_Result_Shp)
New_Layer = Dataset.CreateLayer(Direction_Result_Shp, geom_type= ogr.wkbPolygon)
number = 0
for i in range(0, Number_Of_Park):
H = layer_park.GetNextFeature()
H_geometry = H.GetGeometryRef()
New_Layer.CreateFeature(H)
Dataset.Destroy()