Ejemplo n.º 1
0
    def testmeta(self):
        fcws = 'c:\\temp'
        fcnm = os.path.basename(arcpy.CreateScratchName('tmp.shp', workspace=fcws))

        fc = arcpy.FeatureClassToFeatureClass_conversion(
            self.t_fc,
            fcws,
            fcnm
        ).getOutput(0)

        ap.meta(fc, 'OVERWRITE', title="Bar")
        ap.meta(fc, 'append', purpose='example', abstract='Column Spam means eggs')

        ap.dlt(fc)
        pass
Ejemplo n.º 2
0
 def testdlt(self):
     est = []
     wc = '"OBJECTID" < 11'
     lr = arcpy.management.MakeFeatureLayer(self.t_fc, "lr", wc).getOutput(0)
     # TODO: test for deleting layers won't pass even though ap.dlt works
     #print lr
     #print arcpy.Exists(lr)
     tempfc = 'in_memory\\tmp'
     if arcpy.Exists(tempfc):
         arcpy.Delete_management(tempfc)
     tmpfc = arcpy.CopyFeatures_management(lr, tempfc).getOutput(0)
     fc = arcpy.CopyFeatures_management(tmpfc, arcpy.CreateScratchName("tmp.shp", workspace="c:\\temp")).getOutput(0)
     ap.dlt(lr)
     est.append(ap.dlt(tmpfc))
     est.append(ap.dlt(fc))
     est.append(ap.dlt('this does not exist'))
     self.assertEquals(est, [True, True, False])
     pass
Ejemplo n.º 3
0
    def testmeta(self):
        fcws = 'c:\\temp'
        fcnm = os.path.basename(arcpy.CreateScratchName('tmp.shp', workspace=fcws))

        # testing entries
        ttl,pps,abt = "Bar","example", "Column Spam means eggs"

        fc = arcpy.FeatureClassToFeatureClass_conversion(
            self.t_fc,
            fcws,
            fcnm
        ).getOutput(0)
        ap.meta(fc, 'OVERWRITE', title=ttl)
        editted = ap.meta(fc, 'append', purpose=pps, abstract=abt)
        editted = ap.meta(fc, 'overwrite', title=ttl, purpose=pps, abstract=abt)
        retrieved = ap.meta(fc)
        ap.dlt(fc)
        self.assertEqual(set(editted.values()), set(retrieved.values()))
Ejemplo n.º 4
0
 def testdlt(self):
     est = []
     wc = '"OBJECTID" < 11'
     lr = arcpy.management.MakeFeatureLayer(self.t_fc, "lr", wc).getOutput(0)
     # TODO: test for deleting layers won't pass even though ap.dlt works
     #print lr
     #print arcpy.Exists(lr)
     tempfc = 'in_memory\\tmp'
     if arcpy.Exists(tempfc):
         arcpy.Delete_management(tempfc)
     tmpfc = arcpy.CopyFeatures_management(lr, tempfc).getOutput(0)
     tempshp = arcpy.CreateScratchName('tmp.dbf', workspace='c:\\temp').replace('.dbf', '.shp')
     fc = arcpy.CopyFeatures_management(tmpfc, tempshp).getOutput(0)
     ap.dlt(lr)
     est.append(ap.dlt(tmpfc))
     est.append(ap.dlt(fc))
     est.append(ap.dlt('this does not exist'))
     self.assertEquals(est, [True, True, False])
     pass
Ejemplo n.º 5
0
    def testmeta(self):
        fcws = 'c:\\temp'
        tempshp = arcpy.CreateScratchName('tmp.dbf', workspace=fcws).replace('.dbf', '.shp')
        fcnm = os.path.basename(tempshp)

        # testing entries
        ttl,pps,abt = "Bar","example", "Column Spam means eggs"

        fc = arcpy.FeatureClassToFeatureClass_conversion(
            self.t_fc,
            fcws,
            fcnm
        ).getOutput(0)
        ap.meta(fc, 'OVERWRITE', title=ttl)
        editted = ap.meta(fc, 'append', purpose=pps, abstract=abt)
        editted = ap.meta(fc, 'overwrite', title=ttl, purpose=pps, abstract=abt)
        retrieved = ap.meta(fc)
        ap.dlt(fc)
        self.assertEqual(set(editted.values()), set(retrieved.values()))
Ejemplo n.º 6
0
# 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'])


# Make a quick map
# If you are in ArcMap's Python window, add fc as a feature layer.
Ejemplo n.º 7
0
# 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'])

# Make a quick map
# If you are in ArcMap's Python window, add fc as a feature layer.
# This will add the layer if your ArcMap's Geoprocessing options