サマリー
EnvManager is a class for managing geoprocessing environments.
The environment settings set by the EnvManager class are temporary and are only set for the duration of the with block. At the completion of the with block, the environments passed to the EnvManager class will be reset to their values prior to the EnvManager class (you do not need to reset the environment values yourself).
構文
EnvManager (**kwargs)
パラメーター | 説明 | データ タイプ |
**kwargs | Environment settings are passed as keyword arguments; one or more environments can be passed using the environment name.
For a full list of the environments and their names, see the env class. | Variant |
方法の概要
方法 | 説明 |
reset () | Resets the environment settings to their values prior to calling EnvManager. |
方法
reset ()
コードのサンプル
Use EnvManager to temporarily set the cellSize and extent environments prior to executing the PointDensity tool.
import arcpy
feature_class = r'd:\data\data.gdb\cities'
with arcpy.EnvManager(cellSize=10, extent='-16, 25, 44, 64'):
raster = arcpy.sa.PointDensity(feature_class, 'POP_RANK')
Use EnvManager to temporarily set the workspace environment prior to accessing the ListFeatureClasses function.
import arcpy
with arcpy.EnvManager(workspace=r'd:\data\data.gdb'):
feature_classes = arcpy.ListFeatureClasses(feature_type='POLYGON')
print('The polygon feature classes are {}'.format(', '.join(feature_classes)))