本文整理匯總了Python中arccore.utils.AIUtils.AIUtils.list2json方法的典型用法代碼示例。如果您正苦於以下問題:Python AIUtils.list2json方法的具體用法?Python AIUtils.list2json怎麽用?Python AIUtils.list2json使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arccore.utils.AIUtils.AIUtils
的用法示例。
在下文中一共展示了AIUtils.list2json方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: AISde
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import list2json [as 別名]
sdePassword = sdeInfos[3]
try:
sde = AISde(
os.path.join(rootPath, "resources", "sde"),
wksId,
sdeServer + "/" + sdeInstance,
sdeUsername,
sdePassword,
)
sde.connect()
except Exception as e:
logger.info(unicode(e.message).encode("utf-8"))
logger.info("數據庫服務器" + sdeServer + "上空間數據庫" + sdeInstance + "實例連接失敗")
logger.info("數據庫服務器" + sdeServer + "上空間數據庫" + sdeInstance + "實例連接成功")
wks = AIWks(sde.getSdeOutFullName(), sde.getSdeUserName())
logger.info("工作空間" + sde.getSdeOutFullName() + "初始化成功")
# 查詢要素集
param2 = sys.argv[2]
param2 = param2.replace("null", "''")
fds = AIFds()
fds = fds.fromStr(param2)
try:
fdss = wks.queryFdsList(fds)
if not AIUtils.isEmpty(fdss) and len(fdss) > 0:
qr = AIUtils.list2json([AIUtils.str2dict(str(fds)) for fds in fdss])
except Exception as e:
logger.info(unicode(e.message).encode("utf-8"))
logger.info("要素集" + fds.getName() + "查詢失敗")
print qr
示例2: AISde
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import list2json [as 別名]
sdeInfos = sdeInfo.split('/')
sdeServer = sdeInfos[0]
sdeInstance = sdeInfos[1]
sdeUsername = sdeInfos[2]
sdePassword = sdeInfos[3]
try:
sde = AISde(os.path.join(rootPath, 'resources', 'sde'), wksId, sdeServer + '/' + sdeInstance, sdeUsername, sdePassword)
sde.connect()
except Exception as e:
logger.info(unicode(e.message).encode("utf-8"))
logger.info('數據庫服務器' + sdeServer + '上空間數據庫' + sdeInstance + '實例連接失敗')
logger.info('數據庫服務器' + sdeServer + '上空間數據庫' + sdeInstance + '實例連接成功')
wks = AIWks(sde.getSdeOutFullName(), sde.getSdeUserName())
logger.info('工作空間' + sde.getSdeOutFullName() + '初始化成功')
# 查詢要素類列表
param2 = sys.argv[2]
param2 = param2.replace('null', '\'\'')
fcDict = AIUtils.str2dict(param2)
fdsName = fcDict['name']
fc = AIFc()
fc = fc.fromStr(param2)
try:
fcs = wks.queryFcList(fc)
if not AIUtils.isEmpty(fcs) and len(fcs) > 0:
qr = AIUtils.list2json([AIUtils.str2dict(str(fc)) for fc in fcs])
except Exception as e:
logger.info(unicode(e.message).encode("utf-8"))
logger.info('要素類' + fc.getName() + ' 查詢失敗')
print qr