ArcGIS for Desktop

  • ドキュメント
  • 価格
  • サポート

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS for Desktop

完全なプロ仕様の GIS

ArcGIS for Server

エンタープライズ GIS

ArcGIS for Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • 価格
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

ヘルプ

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • その他...

フィールドの削除 (Delete Field)

  • サマリ
  • 使用法
  • 構文
  • コードのサンプル
  • 環境
  • ライセンス情報

サマリ

テーブル、フィーチャクラス、フィーチャ レイヤー、またはラスター データセットから 1 つ以上のフィールドを削除します。

使用法

  • このツールは、任意のテーブル (ArcSDE、ファイル、またはパーソナル ジオデータベース フィーチャクラス、カバレッジ、ラスター データセット、シェープファイル) で使用できます。

  • フィールドは、VPF や CAD データセットなど、ArcGIS で非ネイティブの読み取り専用データ形式からは削除できません。

  • [削除するフィールド] パラメーターの [フィールドの追加] ボタンは、ModelBuilder だけで使用されます。ModelBuilder では、先のツールが実行されていないか、出力データが存在しないために、[削除するフィールド] パラメーターにフィールド名が表示されない場合があります。[フィールドの追加] ボタンを使用すると、[フィールドの削除] ダイアログ ボックスを完了してモデルの作成を続行できるように、必要なフィールドを追加することができます。

構文

DeleteField_management (in_table, drop_field)
パラメータ説明データ タイプ
in_table

削除するフィールドを含むテーブル。既存の入力テーブルが変更されます。

Mosaic Layer; Raster Catalog Layer; Raster Layer; Table View
drop_field
[drop_field,...]

入力テーブルから削除するフィールド。不要なフィールドのみを削除できます。

Field

コードのサンプル

DeleteField (フィールドの削除) の例 (Python ウィンドウ)

次の Python ウィンドウ スクリプトは、イミディエイト モードで DeleteField (フィールドの削除) ツールを使用する方法を示しています。

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.CopyFeatures_management("majorrds.shp", "C:/output/majorrds_copy.shp")
arcpy.DeleteField_management("C:/output/majorrds_copy.shp", 
                             ["STREET_NAM", "LABEL", "CLASS"])
DeleteField (フィールドの削除) の例 2 (スタンドアロン スクリプト)

次のスタンドアロン スクリプトは、DeleteField (フィールドの削除) ツールの使用方法を示しています。

# Name: DeleteField_Example2.py
# Description: Delete several fields from a feature class
  
# Import system modules
import arcpy
 
# Set environment settings
arcpy.env.workspace = "C:/data"
 
# Set local variables
inFeatures = "accident.dbf"
outFeatureClass = "C:/output/new_accident.dbf"
dropFields = ["STREET_NAM", "LABEL", "CLASS"]
 
# Execute CopyFeatures to make a new copy of the feature class
#  Use CopyRows if you have a table
arcpy.CopyFeatures_management(inFeatures, outFeatureClass)
 
# Execute DeleteField
arcpy.DeleteField_management(outFeatureClass, dropFields)
DeleteField (フィールドの削除) の例 3 (スタンドアロン スクリプト)

DeleteField (フィールドの削除) を使用して、フィーチャクラスまたはテーブルから不要なすべてのフィーチャを消去します。

# Name: DeleteFields_clearfields.py
# Description: Delete unrequired fields from a feature class or tble.
 
# Import system modules
import arcpy
 
try: 
    # Get user-supplied input and output arguments
    inTable = arcpy.GetParameterAsText(0)
    updatedTable = arcpy.GetParameterAsText(1)
 
    # Describe the input (need to test the dataset and data types)
    desc = arcpy.Describe(updatedTable)
 
    # Make a copy of the input (so we can mantain the original as is)
    if desc.datasetType == "FeatureClass":
        arcpy.CopyFeatures_management(inTable, updatedTable)
    else:
        arcpy.CopyRows_management(inTable, updatedTable)
 
    # Use ListFields to get a list of field objects
    fieldObjList = arcpy.ListFields(updatedTable)
 
    # Create an empty list that will be populated with field names        
    fieldNameList = []
 
    # For each field in the object list, add the field name to the
    #  name list.  If the field is required, exclude it, to prevent errors
    for field in fieldObjList:
        if not field.required:
            fieldNameList.append(field.name)
 
    # dBASE tables require a field other than an OID and Shape.  If this is
    #  the case, retain an extra field (the first one in the original list)
    if desc.dataType in ["ShapeFile", "DbaseTable"]:
        fieldNameList = fieldNameList[1:]
 
    # Execute DeleteField to delete all fields in the field list. 
    arcpy.DeleteField_management(updatedTable, fieldNameList)
          
except Exception as err:
    print(err.args[0])

環境

  • 現在のワークスペース

ライセンス情報

  • ArcGIS for Desktop Basic: ○
  • ArcGIS for Desktop Standard: ○
  • ArcGIS for Desktop Advanced: ○

関連トピック

  • フィールド ツールセットの概要
このトピックへのフィードバック

ArcGIS for Desktop

  • ホーム
  • ドキュメント
  • 価格
  • サポート

ArcGIS プラットフォーム

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

Esri について

  • 会社概要
  • 採用情報
  • スタッフ ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | プライバシー | リーガル