本文整理汇总了Python中arccore.utils.AIUtils.AIUtils.isDict方法的典型用法代码示例。如果您正苦于以下问题:Python AIUtils.isDict方法的具体用法?Python AIUtils.isDict怎么用?Python AIUtils.isDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arccore.utils.AIUtils.AIUtils
的用法示例。
在下文中一共展示了AIUtils.isDict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fromStr
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isDict [as 别名]
def fromStr(self, attrs):
obj = None
if AIUtils.isStr(attrs):
attrs = AIUtils.str2dict(attrs)
obj = self
if AIUtils.isDict(attrs):
for key in attrs:
func = getattr(obj, 'set' + AIStrUtils.toUpperF(key))
if AIUtils.isFunc(func):
apply(func, [attrs[key]])
else:
raise Exception('input parameter type not correct!')
return obj
示例2: toStr
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isDict [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 isDict [as 别名]
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:
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 not AIUtils.isEmpty(fcFds['name']):
fdsName = fcFds['name']
fdsName = fdsName if ('.' in fdsName) else fdsName if AIUtils.isEmpty(sdeUsername) else (sdeUsername + '.') + fdsName
try:
if not AIUtils.isEmpty(fdsName):
fdsName = fdsName if ('.' in fdsName) else fdsName if AIUtils.isEmpty(sdeUsername) else (sdeUsername + '.') + fdsName
datasets = arcpy.ListDatasets(fdsName, 'Feature')
if len(datasets) > 0 and not AIUtils.isEmpty(datasets[0]):
dataset = datasets[0]
desc = arcpy.Describe(dataset)
sr = desc.spatialReference
fcFds = {'name' : AIUtils.unicode2utf8(desc.name), 'wkid' : None if AIUtils.isEmpty(sr) else sr.factoryCode}
except Exception as e:
logger.info(unicode(e.message).encode("utf-8"))
logger.info('要素集' + fdsName + '查询失败')
示例4: if
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isDict [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:
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 \