Skip to main content

Table

汇总

可使用工作空间路径或 URL 引用表,以将其添加到 地图

讨论

有关详细说明,请参阅 表类 帮助。

语法

Table(table_data_source)

参数 说明 数据类型

table_data_source

A string that includes the full workspace path or URL, including the name of the table. For SDE tables, the workspace path is the path to an SDE connection file.

String

返回值

数据类型 说明

Table

Table 对象可用于访问基本表属性。

代码示例

Table 示例 1

以下脚本为所有地图中的所有表打印具有损坏数据源的独立表名称。

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
for m in aprx.listMaps():
    for tbl in m.listTables():
        if tbl.isBroken:
            print(f"Table: {tbl.name} is broken in map: {m.name}")
del aprx
Table 示例 2

以下脚本将文件地理数据库中的表添加到地图中。

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
addTab = arcpy.mp.Table(r"C:\Projects\YosemiteNP\Data_Vector\YosemiteData.gdb\NHDFCode")
m = aprx.listMaps("Yose*")[0]
m.addTable(addTab)
del aprx