本文整理汇总了Python中arccore.utils.AIUtils.AIUtils.isList方法的典型用法代码示例。如果您正苦于以下问题:Python AIUtils.isList方法的具体用法?Python AIUtils.isList怎么用?Python AIUtils.isList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arccore.utils.AIUtils.AIUtils
的用法示例。
在下文中一共展示了AIUtils.isList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setFields
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isList [as 别名]
def setFields(self, fields):
nflds = []
if not AIUtils.isEmpty(fields) and AIUtils.isList(fields):
for fld in fields:
nfld = AIFld()
for key in fld:
func = getattr(nfld, 'set' + AIStrUtils.toUpperF(key))
if AIUtils.isFunc(func):
apply(func, [fld[key]])
nflds.append(nfld)
self.__fields = nflds
示例2: toStr
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isList [as 别名]
def toStr(self, obj):
result = None
if not AIUtils.isEmpty(obj):
attrs = dir(obj)
result = []
for attr in attrs:
if attr.startswith('get'):
prop = AIStrUtils.toLowerF(attr[3:])
func = getattr(obj, attr)
value = apply(func, [])
# 判断类型,不同的字符串转换方式
propValue = AIUtils.list2str(value) if AIUtils.isList(value) \
else AIUtils.dict2str(value) if AIUtils.isDict(value) \
else ('\'' + AIUtils.toStr(value) + '\'') if AIUtils.isStr(value) \
else AIUtils.toStr(value)
result.append('\'' + prop + '\':' + propValue + '')
result = '{' + ','.join(result) + '}'
else:
raise Exception('input parameter type not correct!')
return result
示例3: if
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isList [as 别名]
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:
# 字段名
fldName = arcpy.ValidateFieldName(fldName, wksName)
# 字段别名
fldAlias = fldName if not 'alias' in keys else field['alias']
# 字段类型 Integer--LONG Double--DOUBLE String--TEXT Date--DATE
fldType = 'TEXT' if AIStrUtils.isEqual(AIStrUtils.toUpper(field['ftype']), 'STRING') else field['ftype']
# 字段小数点位数(浮点型)
示例4: len
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isList [as 别名]
param2 = param2.replace('true', 'True')
param2 = param2.replace('false', 'False')
fcDict = AIUtils.str2dict(param2)
keys = fcDict.keys()
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:
nalias = fcAlias # 要素新别名
nFields = fcFields # 新字段集合
nFieldNames = None
if AIUtils.isList(fcFields):
nFieldNames = [nfld['name'] for nfld in fcFields] # 新字段名集合
if not AIUtils.isEmpty(fcName):
fcName = fcName if ('.' in fcName) else fcName if AIUtils.isEmpty(sdeUsername) else (sdeUsername + '.') + fcName
fcFtype = 'All' if AIUtils.isEmpty(fcFtype) else 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('\\', '/')
featureclasses = arcpy.ListFeatureClasses(fcName, fcFtype, fdsName)
if len(featureclasses) > 0 and not AIUtils.isEmpty(featureclasses[0]):
featureclass = featureclasses[0]
desc = arcpy.Describe(featureclass)