コード例 #1
0
ファイル: arcapi_test.py プロジェクト: clintdow/arcapi
    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
コード例 #2
0
ファイル: arcapi_test.py プロジェクト: macoylo/arcapi
    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()))
コード例 #3
0
ファイル: arcapi_test.py プロジェクト: gdherbert/arcapi
    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()))
コード例 #4
0
ファイル: arcapi_tutorial.py プロジェクト: AlexArcPy/arcapi
# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
# convert it to a Python dictionary. I simply re-typed help of 'sp':
# http://cran.r-project.org/web/packages/sp/sp.pdf
landuse2luse = {
    'Aa': 'Agriculture/unspecified', 'Ab': 'Agr/sugar beetsm',
    'Ag': 'Agr/small grains', 'Ah': 'Agr/??', 'Am': 'Agr/maize', 'B': 'woods',
    'Bw': 'trees in pasture', 'DEN': '??', 'Fh': 'tall fruit trees',
    'Fl': 'low fruit trees', 'Fw': 'fruit trees in pasture',
    'Ga': 'home gardens', 'SPO': 'sport field', 'STA': 'stable yard',
    'Tv': '??', 'W': 'pasture'
}
# now we need to add a column for these labels
ap.add_col(fc, 'luse', 'TEXT')
# and update the column with landuse dictionary:
# (If you're in ArcMap and fc's attribute table is open,
# you will need to Reload Cache in Table Options.)
ap.update_col_from_dict(fc, landuse2luse, 'luse', 'landuse')

# So why didn't we use table join to do this? You could, especially if you
# have Advanced license so you can use JoinFied_management. With Basic license,
# it is much easier to use ap.update_col_from_dict, which is also pretty
# fast on mederate-sized datasets thanks to the use of an update cursor.

# Finally, make a note about this update to metadata of fc
ap.meta(fc, 'APPEND', abstract='Updated at ' + ap.tstamp())

# To list all functions available in arcapi and their help:
help(ap.arcapi)
コード例 #5
0
ファイル: arcapi_tutorial.py プロジェクト: CalebM1987/arcapi
    'Bw': 'trees in pasture',
    'DEN': '??',
    'Fh': 'tall fruit trees',
    'Fl': 'low fruit trees',
    'Fw': 'fruit trees in pasture',
    'Ga': 'home gardens',
    'SPO': 'sport field',
    'STA': 'stable yard',
    'Tv': '??',
    'W': 'pasture'
}
# now we need to add a column for these labels
ap.add_col(fc, 'luse', 'TEXT')
# and update the column with landuse dictionary:
# (If you're in ArcMap and fc's attribute table is open,
# you will need to Reload Cache in Table Options.)
ap.update_col_from_dict(fc, landuse2luse, 'luse', 'landuse')

# So why didn't we use table join to do this?
# You could, especially if you have Advanced
# license so you can use JoinFied_management.
# With Basic license, it is much easier to use
# ap.update_col_from_dict, which is also pretty
# fast with its update cursor.

# Finally, make a note about this update to metadata of fc
ap.meta(fc, 'APPEND', abstract='Updated at ' + ap.tstamp())

# To list all functions available in arcapi and their help:
help(ap)