LogMetadata

サマリー

The LogMetadata class controls whether metadata will be included when running geoprocessing tools.

説明

Metadata logging is activated by default. When using the LogMetadata class as a function decorator or in a with block as a context manager, the logging settings will only persist for the duration of the function or with block. To set metadata logging for an entire script, use the SetLogMetadata function.

構文

LogMetadata (log_metadata)
パラメーター説明データ タイプ
log_metadata

Specifies whether the dataset metadata will be updated.

  • True—The dataset metadata will be updated. The dataset metadata will contain a Geoprocessing history section with logging of the tools used with that dataset.
  • False—The dataset metadata will not be updated.
Boolean

コードのサンプル

LogMetadata example 1

Use the LogMetadata class as a context manager.

import arcpy
gdb = r"d:\data\data.gdb"

with arcpy.LogMetadata(False):
    arcpy.management.CreateFeatureclass(gdb, "Cities", "POINT")
LogMetadata example 2

Use the LogMetadata class as a function decorator.

import arcpy

@arcpy.LogMetadata(False)
def myFunc(gdb, name):
    arcpy.management.CreateFeatureclass(gdb, name, "POINT")

gdb = r"d:\data\data.gdb"
myFunc(gdb, "Cities")