arcgis 获得路径和环境变量信息

import arcpy

import sys
import os
import string

reload(sys)
sys.setdefaultencoding("utf8")
scratchWS = arcpy.env.scratchWorkspace
arcpy.AddMessage("默认地理数据库路径:" + scratchWS)
scriptPath      = sys.path[0];
arcpy.AddMessage("系统路径:" + scriptPath)
toolSharePath   = os.path.dirname(scriptPath)
arcpy.AddMessage("路径:" + toolSharePath)
scratchWS = arcpy.GetSystemEnvironment("TEMP")
arcpy.AddMessage("临时:" + toolSharePath)
arcpy.AddMessage(arcpy.GetMessages())


environments = arcpy.ListEnvironments()

########################################################
#
environments.sort(key=string.lower)

for environment in environments:
    # As the environment is passed as a variable, use Python's getattr
    #   to evaluate the environment's value
    #
    envSetting = getattr(arcpy.env, environment)

    # Format and print each environment and its current setting
    #
    arcpy.AddMessage( "{0:<30}: {1}".format(environment, envSetting))

 

 

 

结果:

默认地理数据库路径:C:\Users\Administrator\Documents\ArcGIS\Default.gdb
系统路径:D:\
路径:D:\
临时:D:\
autoCommit                    : 1000
cartographicCoordinateSystem  : None
cellSize                      : MAXOF
coincidentPoints              : MEAN
compression                   : LZ77
configKeyword                 : None
derivedPrecision              : HIGHEST
extent                        : None
geographicTransformations     : None
maintainSpatialIndex          : False
mask                          : None
MDomain                       : None
MResolution                   : None
MTolerance                    : None
newPrecision                  : SINGLE
outputCoordinateSystem        : None
outputMFlag                   : Same As Input
outputZFlag                   : Same As Input
outputZValue                  : None
projectCompare                : NONE
pyramid                       : PYRAMIDS -1 NEAREST DEFAULT 75
qualifiedFieldNames           : True
randomGenerator               : 0 ACM599
rasterStatistics              : STATISTICS 1 1
referenceScale                : None
scratchWorkspace              : C:\Users\Administrator\Documents\ArcGIS\Default.gdb
snapRaster                    : None
spatialGrid1                  : 0.0
spatialGrid2                  : 0.0
spatialGrid3                  : 0.0
terrainMemoryUsage            : False
tileSize                      : 128 128
tinSaveVersion                : CURRENT
workspace                     : C:\Users\Administrator\Documents\ArcGIS\Default.gdb
XYDomain                      : None
XYResolution                  : None
XYTolerance                   : None
ZDomain                       : None
ZResolution                   : None
ZTolerance                    : None
Completed script 脚本...
成功 在 Sat Nov 16 08:28:26 2013 (经历的时间: 1.00 秒)

 

你可能感兴趣的:(arcgis)