Exemple #1
0
        if wksId in sdeIds:
            sdeInfo = cf.get('sde', wksId)
            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', '\'\'')
#             fdsDict = AIUtils.str2dict(param2)
#             name = fdsDict['name']
            fds = AIFds()
            fds = fds.fromStr(param2)
            try:
                fds = wks.queryFds(fds)
                qr = AIUtils.dict2json(AIUtils.str2dict(str(fds)))
                qr = '' if not qr else qr
            except Exception as e:            
                logger.info(unicode(e.message).encode("utf-8"))
                logger.info('要素集' + fds.getName() + '查询失败') 
Exemple #2
0
            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
Exemple #3
0
     if wksId in sdeIds:
         sdeInfo = cf.get('sde', wksId)
         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', '\'\'')
         param2 = param2.replace('true', 'True')
         param2 = param2.replace('false', 'False')
         fc = AIFc()
         fc = fc.fromStr(param2)
         try:
             flag = 'true' if wks.updateFc(fc) else 'false'
         except Exception as e:            
             logger.info(unicode(e.message).encode("utf-8"))
             logger.info('要素类' + fc.getName() + '更新失败') 
         
 print flag
Exemple #4
0
     # 获取sde连接文件
     sdeIds = cf.options('sde')
     if wksId in sdeIds:
         sdeInfo = cf.get('sde', wksId)
         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', '\'\'')
         param2 = param2.replace('true', 'True')
         param2 = param2.replace('false', 'False')
         fc = AIFc()
         fc = fc.fromStr(param2)
         try:
             flag = 'true' if wks.removeFc(fc) else 'false'
         except Exception as e:            
             logger.info(unicode(e.message).encode("utf-8"))
             logger.info('要素类' + fc.getName() + '删除失败') 
 print flag
Exemple #5
0
     cf.read(os.path.join(rootPath, 'resources', 'conf', 'config.conf'))     
     # 获取sde连接文件
     sdeIds = cf.options('sde')
     if wksId in sdeIds:
         sdeInfo = cf.get('sde', wksId)
         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', '\'\'')
         fds = AIFds()
         fds = fds.fromStr(param2)
         try:
             flag = 'true' if wks.removeFds(fds) else 'false'
         except Exception as e:            
             logger.info(unicode(e.message).encode("utf-8"))
             logger.info('要素集' + fds.getName() + '删除失败') 
 print flag
Exemple #6
0
 if wksId in sdeIds:
     sdeInfo = cf.get('sde', wksId)
     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"))
Exemple #7
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", "''")
            fds = AIFds()
            fds = fds.fromStr(param2)
            try:
                flag = "true" if wks.addFds(fds) else "false"
            except Exception as e:
                logger.info(unicode(e.message).encode("utf-8"))
                logger.info("要素集" + fds.getName() + "新增失败")
    print flag
Exemple #8
0
     if wksId in sdeIds:
         sdeInfo = cf.get('sde', wksId)
         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', '\'\'')
         param2 = param2.replace('true', 'True')
         param2 = param2.replace('false', 'False')
         fc = AIFc()
         fc = fc.fromStr(param2)
         try:
             flag = 'true' if wks.addFc(fc) else 'false'
         except Exception as e:            
             logger.info(unicode(e.message).encode("utf-8"))
             logger.info('要素类' + fc.getName() + '新增失败') 
             
 print flag
Exemple #9
0
     # 获取sde连接文件
     sdeIds = cf.options('sde')
     if wksId in sdeIds:
         sdeInfo = cf.get('sde', wksId)
         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', '\'\'')
         fc = AIFc()
         fc = fc.fromStr(param2)
         try:
             fc = wks.queryFc(fc)
             qr = AIUtils.dict2json(AIUtils.str2dict(str(fc)))
             qr = '' if not qr else qr
         except Exception as e:            
             logger.info(unicode(e.message).encode("utf-8"))
             logger.info('要素类' + fc.getName() + ' 查询失败')
 print qr