Synthèse
The LogMetadata class controls whether metadata will be included when running geoprocessing tools.
Discussion
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.
Syntaxe
LogMetadata (log_metadata)
| Paramètre | Explication | Type de données |
log_metadata | Specifies whether the dataset metadata will be updated.
| Boolean |
Exemple de code
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")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")Vous avez un commentaire à formuler concernant cette rubrique ?