移除连接 (数据管理)

摘要

要素图层表视图中移除连接

用法

语法

RemoveJoin_management (in_layer_or_view, join_name)
参数说明数据类型
in_layer_or_view

要移除连接的图层或表视图。

Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View
join_name

要移除的连接。

String

代码示例

移除连接示例(Python 窗口)

以下 Python 窗口脚本演示了如何在立即模式下使用 RemoveJoin 函数。

import arcpy from arcpy import env env.workspace = "C:/data/data.gdb" arcpy.RemoveJoin_management("veglayer", "vegtable")
移除连接示例 2(独立脚本)

此独立脚本中 RemoveJoin 函数是工作流的一部分,该工作流将向表中添加字段并基于连接表中字段的值计算该字段值。

# AddFieldFromJoin.py # Description: Adds a field to a table, and calculates its values based #              on the values in a field from a joined table # Author: ESRI  # Import system modules import arcpy from arcpy import env  try:     # set the environments     env.workspace = "C:/data"     env.qualifiedFieldNames = "UNQUALIFIED"          # Define script parameters         inFeatures = "Habitat_Analysis.gdb/vegtype"     layerName = "veg_layer"     newField = "description"     joinTable = "vegtable.dbf"     joinField = "HOLLAND95"     calcExpression = "!vegtable.VEG_TYPE!"     outFeature = "Habitat_Analysis.gdb/vegjoin335"          # Add the new field     arcpy.AddField_management (inFeatures, newField, "TEXT")          # Create a feature layer from the vegtype featureclass     arcpy.MakeFeatureLayer_management (inFeatures,  layerName)          # Join the feature layer to a table     arcpy.AddJoin_management (layerName, joinField, joinTable, joinField)          # Populate the newly created field with values from the joined table     arcpy.CalculateField_management (layerName, newField, calcExpression, "PYTHON")          # Remove the join     arcpy.RemoveJoin_management (layerName, "vegtable")          # Copy the layer to a new permanent feature class     arcpy.CopyFeatures_management (layerName, outFeature)      except Exception, e:          import traceback, sys     tb = sys.exc_info()[2]     print "Line %i" % tb.tb_lineno     print e.message

环境

相关主题

许可信息

ArcView: 是
ArcEditor: 是
ArcInfo: 是

7/10/2012