godataselect = "SELECT gd.primary_key, ........... 'Assault Aggravated')" rows = dbCursor.execute(godataselect) incs = r'C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\State Plane\NAD 1927 (US Feet)\NAD 1927 StatePlane Utah Central FIPS 4302.prj' inSF = arcpy.SpatialReference(incs) outcs = 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.0\\Coordinate Systems\\Projected Coordinate Systems\\State Plane\\NAD 1983 (US Feet)\\NAD 1983 StatePlane Utah Central FIPS 4302 (US Feet).prj' outSF = arcpy.SpatialReference(outcs) arcpy.CreateFeatureclass_management ('default.gdb', 'nad83', 'POINT', 'default.gdb\\template') #NAD83 arcpy.DefineProjection_management ('default.gdb\\nad83', outSF) c = arcpy.InsertCursor('default.gdb\\nad83', inSF) for r in rows: print r rr = c.newRow() rr.xml_primary_key = r[0].strip() rr.officer_id = r[1].strip() rr.report_date = r[2] pnt = arcpy.Point() pnt.X = r[18] #nad 27 x pnt.Y = r[19] #nad 27 y rr.shape = pnt c.insertRow(rr) del rows, c
SearchCursors will let you set a spatial reference, you can insert points at a different spatial ref than what the feature class is set to.
c = arcpy.InsertCursor(myFC, differentSpatialRef) for r in rows: x = c.newRow() pnt = arcpy.Point() pnt.X = r[1] # x in old spatRef pnt.Y = r[2] # y n old spatRef x.shape = pnt c.insertRow(x)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.