ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

移除附件

  • 摘要
  • 插图
  • 用法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

摘要

从地理数据库要素类或表记录中移除附件。由于附件实际并未存储在输入数据集中,因此不会对该要素类或表进行任何更改,但是会对存储附件和保持与输入数据集的连接的关联地理数据库表进行更改。匹配表用于标识哪些输入记录(或记录的属性组)将移除附件。

  • 了解有关地理数据库附件的详细信息
  • 了解有关使用“附件”地理处理工具的详细信息

插图

移除附件图示

用法

  • 如果不使用此工具,可选择另一种方式,即从与输入数据集相同的地理数据库的 InputDataset__ATTACH 表(用于存储附件和保持与输入数据集的连接)中删除所选记录。

语法

RemoveAttachments_management (in_dataset, in_join_field, in_match_table, in_match_join_field, {in_match_name_field})
参数说明数据类型
in_dataset

要从中移除附件的地理数据库表或要素类。不会直接从此表中移除附件,而是从存储附件的关联附件表中移除。输入数据集必须存储在 10.0 或更高版本的地理数据库中,而且表的附件必须已经启用。

Table View
in_join_field

“输入数据集”中的字段,其值与匹配连接字段中的值相匹配。输入数据集和匹配表之间的连接字段值匹配的记录将移除附件。该字段可以是“Object ID”字段或其他任何标识属性。 

Field
in_match_table

确定哪些输入记录将移除附件的表。

Table View
in_match_join_field

匹配表中的字段,指示输入数据集中的哪些记录将移除指定附件。该字段的值可与输入数据集“Object ID”或某些其他标识属性相匹配。

Field
in_match_name_field
(可选)

匹配表中的字段,包含要从输入数据集记录中移除的附件的名称。如果未指定名称字段,则会从匹配连接字段指定的每条记录中移除所有附件。如果指定了名称字段,但是记录的名称字段的值为 null 或为空,则将从该记录中移除所有附件。此字段的值应该为要移除的附件的名称缩写,而不是用于创建原始附件的文件的完整路径。

Field

代码示例

RemoveAttachments 示例(Python 窗口)

以下代码片段说明了如何在 Python 窗口中使用 RemoveAttachments 工具。

import arcpy
arcpy.RemoveAttachments_management(r"C:\Data\City.gdb\Parcels", "ParcelID", r"C:\Data\matchtable.csv", "ParcelID","Picture")
RemoveAttachments 示例(独立 Python 脚本)

以下脚本说明了如何在独立脚本中使用 RemoveAttachments 工具。

## Some of the attachments we added to a feature class are unnecessary, let's remove them.
import csv, arcpy, os, sys
input = r"C:\Data\City.gdb\Parcels"
inputField = "ParcelID"
matchTable = r"C:\Data\matchtable.csv"
matchField = "ParcelID"
nameField = "Picture" 
# create a new Match Table csv file that will tell the RemoveAttachments tool which attachments to delete
writer = csv.writer(open(matchTable, "wb"), delimiter=",")
# write a header row (the table will have two columns: ParcelID and Picture)
writer.writerow([matchField, nameField])
# create a list of the attachments to delete
# removes attachments pic1a.jpg and pic1b.jpg from feature 1, pic3.jpg from feature 3, and pic4.jpg from feature 4.
deleteList = [[1, "pic1a.jpg"], [1, "pic1b.jpg"], [3, "pic3.jpg"], [4, "pic4.jpg"]]
# iterate through the delete list and write it to the Match Table csv
for row in deleteList:
    writer.writerow(row)
del writer
# use the match table with the Remove Attachments tool
arcpy.RemoveAttachments_management(input, inputField, matchTable, matchField, nameField)

环境

  • 当前工作空间

许可信息

  • ArcGIS Desktop Basic: 否
  • ArcGIS Desktop Standard: 是
  • ArcGIS Desktop Advanced: 是

相关主题

  • 附件工具集概述
  • 使用附件地理处理工具

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2018 Esri. | 隐私政策 | 法律声明