def testto_points(self): obs = 10 wc = '"OBJECTID" < ' + str(obs + 1) ofc = arcpy.CreateScratchName("tmp_out.dbf", workspace="c:\\temp").replace('.dbf', '.shp') cs = 27700 ptfc = ap.to_points(self.t_fc, ofc, "POP_EST", "GDP_MD_EST", cs, w = wc) est = int(arcpy.GetCount_management(ptfc).getOutput(0)) arcpy.Delete_management(ptfc) self.assertEqual(est, obs) pass
ur.close() # We have our data in a text file, which we need to import into ArcGIS native # format. We strongly recommend Esri File Geodatabase. # ap has short name tviw for arcpy.management.CreateTableView, # flyr and rlyr for CreateFeatureLayer and CreateRasterLayer. tb = ap.tviw(text, "tb") # check that the names and data types are what you would expect ap.names(tb) ap.types(tb) # or like this: zip(ap.names(tb), ap.types(tb)) # It is point data so let's convert it to a point feature class. # Store it as a point feature class called 'dta' in our base.gdb. fc = ap.to_points(tb, ap.to_scratch('dta'), 'x', 'y', 28992) tmp = ap.head(fc) # We don't need the table view of text any more so get rid of it. ap.dlt(tb) # And we don't need the text file itself either so get rid of it. ap.dlt(text) # Print first 10 records using default settings (columns as rows) tmp = ap.head(fc) # now print 5 rows as a formatted table, print '-' for geometries tmp = ap.head(fc, 5, False, '|', '-') # Print some basic statistics for each column. tmp = ap.summary(fc) # Force lime, soil, and ffreq to be treated as categorical variables. tmp = ap.summary(fc, ['lime', 'soil', 'ffreq'], ['CAT', 'CAT', 'CAT'])
ur.close() # We have our data in a text file, which we need to import # into ArcGIS native format, ideally Esri File Geodatabase. # ap has short name tviw for arcpy.management.CreateTableView, # flyr and rlyr for CreateFeatureLayer and CreateRasterLayer. tb = ap.tviw(text, "tb") # check that the names and data types are what you would expect ap.names(tb) ap.types(tb) # or maybe: zip(ap.names(tb), ap.types(tb)) # It is point data so let's convert it to a point feature class. # Store it as a point feature class called 'dta' in our base.gdb. fc = ap.to_points(tb, ap.to_scratch('dta'), 'x', 'y', 28992) tmp = ap.head(fc) # We don't need the table view of text any more so get rid of it. ap.dlt(tb) # And we don't need the text file itself either so get rid of it. ap.dlt(text) # Print first 10 records using default settings (columns as rows) tmp = ap.head(fc) # now print 5 rows as a formatted table, print '-' for geometries tmp = ap.head(fc, 5, False, '|', '-') # Print some basic statistics for each column. tmp = ap.summary(fc) # Force lime, soil, and ffreq to be treated as categorical variables. tmp = ap.summary(fc, ['lime', 'soil', 'ffreq'], ['CAT', 'CAT', 'CAT'])