本文整理匯總了Python中arccore.utils.AIUtils.AIUtils.isInt方法的典型用法代碼示例。如果您正苦於以下問題:Python AIUtils.isInt方法的具體用法?Python AIUtils.isInt怎麽用?Python AIUtils.isInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arccore.utils.AIUtils.AIUtils
的用法示例。
在下文中一共展示了AIUtils.isInt方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addFds
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import isInt [as 別名]
def addFds(self, fds):
'''
保存要素集
'''
flag = False
if isinstance(fds, AIFds):
name = fds.getName()
if not AIUtils.isEmpty(name):
if not arcpy.Exists(name):
wkid = fds.getWkid()
sr = 4326 if not AIUtils.isInt(wkid) else arcpy.SpatialReference(wkid)
try:
arcpy.CreateFeatureDataset_management(self.__wksName, name, sr)
flag = True
except:
raise
else:
raise Exception('dataset name cannot be duplicated!')
else:
raise Exception('dataset name cannot be empty!')
else:
raise Exception('input parameter type not correct!')
return flag
示例2:
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import isInt [as 別名]
sdeInfos = sdeInfo.split("/")
sdeServer = sdeInfos[0]
sdeInstance = sdeInfos[1]
sdeUsername = sdeInfos[2]
sdePassword = sdeInfos[3]
# 默認文件已經存在
sdeOutFullName = os.path.join(rootPath, "resources", "sde", wksId + ".sde").replace("\\", "/")
# 設置當前工作空間
arcpy.env.workspace = sdeOutFullName
logger.info("工作空間" + sdeOutFullName + "初始化成功")
# 新增要素集
param2 = sys.argv[2]
param2 = param2.replace("null", "''")
param2 = param2.replace("true", "True")
param2 = param2.replace("false", "False")
fdsDict = AIUtils.str2dict(param2)
keys = fdsDict.keys()
fdsName = None if "name" not in keys else fdsDict["name"]
fdsWkid = 4326 if "wkid" not in keys else fdsDict["wkid"]
try:
if not AIUtils.isEmpty(fdsName):
fdsWkid = 4326 if not AIUtils.isInt(fdsWkid) else fdsWkid
arcpy.CreateFeatureDataset_management(sdeOutFullName, fdsName, arcpy.SpatialReference(fdsWkid))
flag = "true"
except Exception as e:
logger.info(unicode(e.message).encode("utf-8"))
logger.info("要素集" + fdsName + "新增失敗")
print flag
示例3: addFc
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import isInt [as 別名]
def addFc(self, fc):
'''
保存要素類
'''
flag = False
if isinstance(fc, AIFc):
name = fc.getName()
ftype = fc.getFtype()
alias = fc.getAlias()
wkid = fc.getWkid()
fds = fc.getFds()
if not AIUtils.isEmpty(name) and not AIUtils.isEmpty(ftype):
if not arcpy.Exists(name):
# 要素集名稱
fdsName = None
if not AIUtils.isEmpty(fds) and isinstance(fds, AIFds) and not AIUtils.isEmpty(fds.getName()):
fdsName = fds.getName()
fdsName = fdsName if ('.' in fdsName) else fdsName if AIUtils.isEmpty(self.__userName) else (self.__userName + '.') + fdsName
wksName = self.__wksName if AIUtils.isEmpty(fdsName) else os.path.join(self.__wksName, fdsName).replace('\\', '/')
fields = fc.getFields()
sr = arcpy.SpatialReference(4326) if not AIUtils.isInt(wkid) else arcpy.SpatialReference(wkid)
try:
# 創建要素類
arcpy.CreateFeatureclass_management(wksName, name, ftype, None, "DISABLED", "DISABLED", sr)
# 更改別名
if not AIUtils.isEmpty(alias):
arcpy.AlterAliasName(name, alias)
# 添加字段(排除保留字段)
for field in fields:
fldName = AIStrUtils.toUpper(field.getName())
if not AIStrUtils.isEqual(fldName, 'OBJECTID') and \
not AIStrUtils.isEqual(fldName, 'NAME') and \
not AIStrUtils.isEqual(fldName, 'SHAPE') and \
not 'AREA' in fldName and \
not 'LEN' in fldName:
# 字段名
fldName = arcpy.ValidateFieldName(fldName, self.__wksName)
# 字段別名
fldAlias = field.getAlias()
# 字段類型 Integer--LONG Double--DOUBLE String--TEXT Date--DATE
fldType = 'TEXT' if AIStrUtils.isEqual(AIStrUtils.toUpper(field.getFtype()), 'STRING') else field.getFtype()
# 字段小數點位數(浮點型)
fldScale = field.getScale()
# 字段長度(文本型)
fldLength = field.getLength()
# 字段是否允許為空
fldIsNullable = field.getIsNullable()
arcpy.AddField_management(name, fldName, fldType, None, fldScale, \
fldLength, fldAlias, fldIsNullable, False)
flag = True
except:
raise
else:
raise Exception('featureclass name cannot be duplicated!')
else:
raise Exception('featureclass name and geometry type cannot be empty!')
else:
raise Exception('input parameter type not correct!')
return flag
示例4: if
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import isInt [as 別名]
fcName = None if 'name' not in keys else fcDict['name']
fcAlias = None if 'alias' not in keys else fcDict['alias']
fcFtype = None if 'ftype' not in keys else fcDict['ftype']
fcWkid = None if 'wkid' not in keys else fcDict['wkid']
fcFds = None if 'fds' not in keys else fcDict['fds']
fcFields = None if 'fields' not in keys else fcDict['fields']
try:
if not AIUtils.isEmpty(fcName) and not AIUtils.isEmpty(fcFtype):
# 要素集名稱
fdsName = None
if AIUtils.isDict(fcFds) and 'name' in fcFds.keys() and not AIUtils.isEmpty(fcFds['name']):
fdsName = fcFds['name']
fdsName = fdsName if ('.' in fdsName) else fdsName if AIUtils.isEmpty(sdeUsername) else (sdeUsername + '.') + fdsName
wksName = sdeOutFullName if AIUtils.isEmpty(fdsName) else os.path.join(sdeOutFullName, fdsName).replace('\\', '/')
fcWkid = 4326 if not AIUtils.isInt(fcWkid) else fcWkid
# 創建要素類
arcpy.CreateFeatureclass_management(wksName, fcName, fcFtype, None, "DISABLED", "DISABLED", arcpy.SpatialReference(fcWkid))
# 更改別名
if not AIUtils.isEmpty(fcAlias):
arcpy.AlterAliasName(fcName, fcAlias)
# 添加字段(排除保留字段)
if AIUtils.isList(fcFields):
for field in fcFields:
keys = field.keys()
fldName = AIStrUtils.toUpper(field['name'])
if not AIStrUtils.isEqual(fldName, 'OBJECTID') and \
not AIStrUtils.isEqual(fldName, 'NAME') and \
not AIStrUtils.isEqual(fldName, 'SHAPE') and \
not 'AREA' in fldName and \
not 'LEN' in fldName: