本文整理汇总了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: