import arcgisscripting gp = arcgisscripting.create(9.3) gp.overwriteoutput = 1 # set the workspace gp.workspace = "C:\\Python_Test" inPolys = "Polygons.shp" #need the spatial reference for the CreateFeatureClass tool below dscFC = gp.Describe(inPolys) sr = dscFC.SpatialReference newFC = "NewFeatures.shp" #if the new shapefile doesn't exist it will be created if not gp.Exists(newFC): gp.CreateFeatureClass_management(gp.workspace, newFC, "POLYGON", inPolys, "", "", sr) oldRows = gp.SearchCursor(inPolys) newRows = gp.InsertCursor(newFC) oldRow = oldRows.Next() while oldRow: #if you need to do anything to the features before they are inserted #into the new shapefile, this is where you would do it. newRows.InsertRow(oldRow) oldRow = oldRows.Next() del gp, dscFC, sr, oldRows, newRows, oldRow
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.