disableTime
汇总
用于对基本表属性和方法进行访问。
讨论
有两种方法可以在脚本中引用表以用于工程。 要引用工程中已有的表,请在 Map class 上使用 listTables 方法。 要直接从工作空间引用表,请使用 Table 函数。 您可能希望使用 listTables 函数引用工程中的表,因为您可能需要更改表的数据源或定义查询,甚至使用 Map 类 removeTable 方法从工程中删除表。 Table 函数对于引用要添加到工程中的新表很有用。 获取到新的外部表源的引用后,可以利用 addTable 方法将其添加到 地图 中。
表可以支持零到多个定义查询,但只能激活一个定义查询。 也有可能存在一个或多个定义查询但没有一个是活动的。 有几种方法可以管理定义查询。 第一种方式,可以使用 definitionQuery 属性。 如果在不具有定义查询的表或具有多个定义查询的表上设置唯一 SQL 字符串,则会添加新定义查询并将其设置为活动查询。 如果在具有相同查询的表上设置 SQL 字符串,则会将其设置为活动定义查询(如果它尚未处于活动状态)。 管理定义查询的第二种方法是结合使用 listDefinitionQueries 和 updateDefinitionQueries 函数。 listDefinitionQueries 函数会返回一个 Python 字典列表,这些字典展示了每个查询关联的属性。 字典关键字是 name 、 sql 和 isActive 。 可以使用核心 Python 方法在 Python 列表中添加、修改或移除定义查询。 可以将字典 isActive 值设置为 True 以设置活动查询。 同样,只有一个查询可以处于活动状态。 如果您尝试将多个查询设置为活动状态,则会返回错误。 更改完成后,使用 updateDefinitionQueries 函数设置新的更改。
使用 enableTime 方法可以在表上启用时间功能。 时间功能启用后, time 属性允许访问 LayerTime 对象,并进一步配置表的时间属性。 有关表的代码示例,请参阅 LayerTime 帮助主题。
可以在 Layout 上使用 TableFrameElement 类来展示和配置表中的字段和行。 要创建表框架,请在 Layout 类上使用 createTableFrameElement 方法。 有关详细信息和代码示例,请参阅 TableFrameElement 类的帮助主题。
更改表的数据源是一项常见要求。 有关详细说明、参数信息、案例和代码示例,请参阅 更新和修复数据源 帮助主题。
语法
disableTime()
属性
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
connectionProperties (只读) |
将表的数据源连接信息返回为 Python 字典。 |
Dictionary |
|
dataSource (只读) |
返回表的数据源的完整路径。 其中包括完整的工作空间路径和数据集的名称。 对于企业级地理数据库表,将返回包含表的连接信息的字符串。 提示:ArcGIS Pro 工程中的企业级地理数据库表不保留用于创建图层的数据库连接文件的路径 ( |
String |
|
definitionQuery (读取和写入) |
用于获得或设置表的定义查询。 |
String |
|
isBroken (只读) |
如果表的数据源已损坏,则返回 |
Boolean |
|
isTimeEnabled (只读) |
指示在表上是否启用时间。 如果 |
Boolean |
|
longName (只读) |
表的全名,包括图层组信息(如果存在)。 例如,位于名为 ' |
String |
|
metadata (读取和写入) |
获取或设置表格的 元数据 类信息。 注:设置元数据取决于 |
Metadata |
|
name (读取和写入) |
用于以表在内容列表中显示的方式设置或获得表名称。 可包含空格。 |
String |
|
time (只读) |
如果在表上启用了时间,则返回一个 LayerTime 对象。 注:
|
LayerTime |
|
URI (只读) |
表的统一资源指示符。 这是工程中表的唯一标识符,使用 Python CIM 访问 时有时需要它。 添加表并建立 URI 后,该值不会随时间变化。 例如,如果您修改表的名称,则 |
String |
方法
disableTime()
禁用 Table 对象上启用时间的属性。
enableTime({startTimeField}, {endTimeField}, {autoCalculateTimeRange}, {timeDimension})
如果表具有时间信息,则在该表上启用时间。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
startTimeField (可选) |
The name of the field containing the start time values. If each row has a single time field, specify that field name in the (默认值为 None) |
String |
|
endTimeField (可选) |
The name of the field containing the end time values. Not all tables use an end time field. If each row has a single time field, specify that field name in the (默认值为 None) |
String |
|
autoCalculateTimeRange (可选) |
If set to True, the start and end time attribute information is used to calculate the table's time extent. (默认值为 True) |
Boolean |
|
timeDimension (可选) |
The name of the dimension containing time values when using netCDF data. (默认值为 None) |
String |
getDefinition(cim_version)
获取表格 CIM 定义。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
cim_version |
A string that represents the major version of the CIM. |
String |
返回值
| 数据类型 | 说明 |
|---|---|
|
Object |
返回 |
getSelectionSet()
以 Python 对象 ID 集的形式返回表选择。
返回值
| 数据类型 | 说明 |
|---|---|
|
List |
以 Python 对象 ID 集的形式返回表选择。 |
listCharts({wildcard})
用于返回表中 chart 对象的 Python 列表。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
wildcard (可选) |
A wildcard is based on the chart title and is not case sensitive. A combination of asterisks (*) and characters can be used to help limit the resulting list. (默认值为 None) |
String |
返回值
| 数据类型 | 说明 |
|---|---|
|
List |
用于返回表中 chart 对象的 Python 列表。 |
listDefinitionQueries({wildcard})
返回与表关联的定义查询的 Python 列表。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
wildcard (可选) |
A wildcard is based on the query name and is not case sensitive. A combination of asterisks (*) and characters can be used to limit the resulting list. (默认值为 None) |
String |
返回值
| 数据类型 | 说明 |
|---|---|
|
List |
表示与每个查询关联的属性的 Python 字典列表。 字典关键字是 |
pasteProperties(source_table, {table_paste_properties[table_paste_properties,...]})
pasteProperties 方法用于将属性从一个表粘贴到另一个表。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
source_table |
A table or feature layer with the properties that will be pasted. |
Table |
|
table_paste_properties[table_paste_properties,...] (可选) |
A single string or a list of strings that specify the property or properties that will be pasted. For example,
(默认值为 ALL) |
String |
saveACopy(file_name)
将表保存为图层文件 (.lyrx)。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
file_name |
A string that includes the location and name of the output layer file ( |
String |
setDefinition(definition_object)
设置表的 CIM 定义。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
definition_object |
使用 |
Object |
setSelectionSet({oidList[oidList,...]}, {method})
使用 Python 对象 ID 列表设置表选择。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
oidList[oidList,...] (可选) |
与相应的选择方法一起使用的 Python 对象 ID 列表。 (默认值为 None) |
List |
|
method (可选) |
用于指定要使用的选择方法的字符串。
(默认值为 NEW) |
String |
updateConnectionProperties(current_connection_info, new_connection_info, {auto_update_joins_and_relates}, {validate}, {ignore_case})
updateConnectionProperties 方法使用工作空间字典或路径替换连接属性。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
current_connection_info |
A string that represents the workspace path or a Python dictionary that contains connection properties to the source you want to update. If an empty string or |
String |
|
new_connection_info |
A string that represents the workspace path or a Python dictionary that contains connection properties with the new source information. |
String |
|
auto_update_joins_and_relates (可选) |
If set to (默认值为 True) |
Boolean |
|
validate (可选) |
If set to (默认值为 True) |
Boolean |
|
ignore_case (可选) |
Determines whether searches will be case sensitive. By default, queries are case sensitive. To perform queries that are not case sensitive, set (默认值为 False) |
Boolean |
updateDefinitionQueries(definitionQueries[definitionQueries,...])
更新表的定义查询集合。
| 名称 | 说明 | 数据类型 |
|---|---|---|
|
definitionQueries[definitionQueries,...] |
Updates a list of dictionaries that represent the properties of each definition query for a table. |
List |
代码示例
以下脚本为所有地图中的所有表打印具有损坏数据源的独立表名称:
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
以下脚本将文件地理数据库中的表添加到地图中:
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