当前位置: 首页>>代码示例>>Python>>正文


Python AIUtils.AIUtils类代码示例

本文整理汇总了Python中arccore.utils.AIUtils.AIUtils的典型用法代码示例。如果您正苦于以下问题:Python AIUtils类的具体用法?Python AIUtils怎么用?Python AIUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AIUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, agsOutFolder, agsOutName, tmpOutFolder, \
              serverName, serverPort, username, password):
     '''
      构造器
     '''
     if not AIUtils.isEmpty(agsOutFolder) and not AIUtils.isEmpty(agsOutName) and not AIUtils.isEmpty(tmpOutFolder):
         self.__agsOutFolder = agsOutFolder
         self.__agsOutName = agsOutName
         self.__tmpOutFolder = tmpOutFolder
         if not self.__agsOutName.endswith('.ags'):
             self.__agsOutName += '.ags'
         server_url_part = self.__serverUrlPre = 'http://' + serverName + ':' + serverPort + '/arcgis'
         server_url = server_url_part + '/admin'
         use_arcgis_desktop_staging_folder = False
         staging_folder_path = self.__agsOutFolder
         self.__agsOutFolder = self.__agsOutFolder.replace('\\', '/')
         self.__agsOutFullName = os.path.join(self.__agsOutFolder, self.__agsOutName).replace('\\', '/')
         
         if not os.path.exists(self.__agsOutFullName):
             arcpy.mapping.CreateGISServerConnectionFile("PUBLISH_GIS_SERVICES",
                                                         self.__agsOutFolder,
                                                         self.__agsOutName,
                                                         server_url,
                                                         "ARCGIS_SERVER",
                                                         use_arcgis_desktop_staging_folder,
                                                         staging_folder_path,
                                                         username,
                                                         password,
                                                         "SAVE_USERNAME") 
开发者ID:Chandler0591,项目名称:mygis,代码行数:29,代码来源:AIAgs.py

示例2: __init__

 def __init__(self, name=None, minScale=0, maxScale=0, transparency=0, visible=True):
     """
     构造器
     """
     self.__name = name
     self.__minScale = 0 if AIUtils.isEmpty(minScale) else minScale
     self.__maxScale = 0 if AIUtils.isEmpty(maxScale) else maxScale
     self.__transparency = 0 if AIUtils.isEmpty(transparency) else transparency
     self.__visible = True if AIUtils.isEmpty(visible) else visible
开发者ID:Chandler0591,项目名称:mygis,代码行数:9,代码来源:AILayer.py

示例3: __init__

 def __init__(self, name = None, alias = None, ftype = None, wkid = 4326, fds = None, fields = []):
     '''
     构造器
     '''
     self.__name = name
     self.__alias = alias
     self.__ftype = ftype
     self.__wkid = 4326 if AIUtils.isEmpty(wkid) else wkid
     self.__fds = None if AIUtils.isEmpty(fds) else fds
     self.__fields = [] if AIUtils.isEmpty(fields) else fields
开发者ID:Chandler0591,项目名称:mygis,代码行数:10,代码来源:AIFc.py

示例4: __init__

 def __init__(self, name = None, alias = None, ftype = None, scale = 0, length = 0, isNullable = True):
     '''
     构造器
     '''
     self.__name = name
     self.__alias = alias
     self.__ftype = ftype
     self.__scale = 0 if AIUtils.isEmpty(scale) else scale
     self.__length = 0 if AIUtils.isEmpty(length) else length
     self.__isNullable = True if AIUtils.isEmpty(isNullable) else isNullable
开发者ID:Chandler0591,项目名称:mygis,代码行数:10,代码来源:AIFld.py

示例5: setFields

 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
开发者ID:Chandler0591,项目名称:mygis,代码行数:12,代码来源:AIFc.py

示例6: fromStr

 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
开发者ID:Chandler0591,项目名称:mygis,代码行数:14,代码来源:AIBean.py

示例7: __init__

 def __init__(self, wksName, userName = None):
     '''
     构造器
     '''
     if not AIUtils.isEmpty(wksName):
         arcpy.env.workspace = self.__wksName = wksName.replace('\\', '/')
         self.__userName = userName
开发者ID:Chandler0591,项目名称:mygis,代码行数:7,代码来源:AIWks.py

示例8: setFds

 def setFds(self, fds):
     nfds = AIFds()
     for key in fds:
         func = getattr(nfds, 'set' + AIStrUtils.toUpperF(key))
         if AIUtils.isFunc(func):
             apply(func, [fds[key]])
             
     self.__fds = nfds
开发者ID:Chandler0591,项目名称:mygis,代码行数:8,代码来源:AIFc.py

示例9: queryFdsList

 def queryFdsList(self, fds):
     '''
 查询要素集列表
     '''
     qrs = []
     if isinstance(fds, AIFds):
         name = fds.getName()
         datasets = arcpy.ListDatasets(None if AIUtils.isEmpty(name) else ('*'+ name + '*'), \
                                       'Feature')
         for dataset in datasets:
             desc = arcpy.Describe(dataset)
             sr = desc.spatialReference
             qrs.append(AIFds(AIUtils.unicode2utf8(desc.name), None if AIUtils.isEmpty(sr) else sr.factoryCode)) 
     else:
         raise Exception('input parameter type not correct!')
     
     return qrs
开发者ID:Chandler0591,项目名称:mygis,代码行数:17,代码来源:AIWks.py

示例10: execute

 def execute(self, sql):
     '''
     执行sql语句
     '''
     sde_conn = None
     sde_return = None
     try:
         sde_conn = None if AIUtils.isEmpty(self.__sdeOutFullName) else arcpy.ArcSDESQLExecute(self.__sdeOutFullName)
         if not AIUtils.isEmpty(sde_conn):
             try:
                 sde_return = sde_conn.execute(sql)
             except:
                 raise
     except:
         raise
     finally:
         del sde_conn
     
     return sde_return
开发者ID:Chandler0591,项目名称:mygis,代码行数:19,代码来源:AISde.py

示例11: publish

 def publish(self, svc):
     '''
      发布服务
     '''
     if not AIUtils.isEmpty(self.__agsOutFullName) and isinstance(svc, AISvc):
         mxdFullName = svc.getMxdFullName()
         serviceName = svc.getServiceName()
         serviceFolder = svc.getServiceFolder()
         description = svc.getDescription()
         serviceItems = svc.getServiceItems()
         
         try:    
             # 生成服务草稿文件
             sddraftFullName = os.path.join(self.__tmpOutFolder, serviceName + '.sddraft')
             sdFullName = os.path.join(self.__tmpOutFolder, serviceName + '.sd')
             mapDoc = arcpy.mapping.MapDocument(mxdFullName)
             arcpy.mapping.CreateMapSDDraft(mapDoc, sddraftFullName, serviceName, 'ARCGIS_SERVER', self.__agsFullName, False, serviceFolder)
             sDDraftEditor = AISEdit(sddraftFullName)
             
             # 添加服务描述
             sDDraftEditor.setItemInfo({'description' : description})
               
             # 添加额外服务能力
             for item in serviceItems:
                 if item.getEnabled():
                     sDDraftEditor.setSvcExtension(item.getTypeName(), 'true')
                 
             analysis = arcpy.mapping.AnalyzeForSD(sddraftFullName)
             
             if analysis['errors'] == {}:
                 # 过度服务草稿文件到SD文件
                 arcpy.StageService_server(sddraftFullName, sdFullName)
                 # 上传SD文件到GIS服务器
                 arcpy.UploadServiceDefinition_server(sdFullName, self.__agsServer)
                 
             # 发布成功存入服务地址
             for item in serviceItems:
                 if item.getEnabled():
                     typeName = item.getTypeName()
                     if AIStrUtils.isEqual(typeName, 'MapServer'):
                         svc.setUrl(self.__serverUrlPre + sDDraftEditor.getMapServerPartRestUrl())
                     elif AIStrUtils.isEqual(typeName, 'KmlServer'):
                         svc.setUrl(self.__serverUrlPre + sDDraftEditor.getKmlRestUrl())
                     elif AIStrUtils.isEqual(typeName, 'FeatureServer'):
                         svc.setUrl(self.__serverUrlPre + sDDraftEditor.getFeatureRestUrl())
                     elif AIStrUtils.isEqual(typeName, 'WFSServer'):
                         svc.setUrl(self.__serverUrlPre + sDDraftEditor.getWMSRestUrl())
                     else:
                         svc.setUrl(self.__serverUrlPre + sDDraftEditor.getWFSRestUrl())
             else: 
                 raise
         except:
             raise
         
         return svc
开发者ID:Chandler0591,项目名称:mygis,代码行数:55,代码来源:AIAgs.py

示例12: queryFds

 def queryFds(self, fds):
     '''
 查询要素集
     '''
     qr = None
     if isinstance(fds, AIFds):
         name = fds.getName()
         if not AIUtils.isEmpty(name):
             name = name if ('.' in name) else name if AIUtils.isEmpty(self.__userName) else (self.__userName + '.') + name
             datasets = arcpy.ListDatasets(name, 'Feature')
             if len(datasets) > 0 and not AIUtils.isEmpty(datasets[0]):
                 dataset = datasets[0]
                 desc = arcpy.Describe(dataset)
                 sr = desc.spatialReference
                 qr = AIFds(AIUtils.unicode2utf8(desc.name), None if AIUtils.isEmpty(sr) else sr.factoryCode)
         else:
             raise Exception('dataset name cannot be empty!')
     else:
         raise Exception('input parameter type not correct!')
     
     return qr
开发者ID:Chandler0591,项目名称:mygis,代码行数:21,代码来源:AIWks.py

示例13: __init__

 def __init__(self, sdeOutFolder, sdeOutName, instance, username, password, \
             databasePlatform = 'ORACLE', accountAuthentication='DATABASE_AUTH'):
     '''
      构造器
     '''
     if not AIUtils.isEmpty(sdeOutFolder) and not AIUtils.isEmpty(sdeOutName):
         self.__sdeOutFolder = sdeOutFolder
         self.__sdeOutName = sdeOutName
         if not self.__sdeOutName.endswith('.sde'):
             self.__sdeOutName += '.sde'
         self.__sdeOutFolder = self.__sdeOutFolder.replace('\\', '/')
         self.__sdeOutFullName = os.path.join(self.__sdeOutFolder, self.__sdeOutName).replace('\\', '/')
         self.__sdeUserName = username
         if not os.path.exists(self.__sdeOutFullName):
             arcpy.CreateDatabaseConnection_management(self.__sdeOutFolder,
                                                       self.__sdeOutName,
                                                       databasePlatform,
                                                       instance,
                                                       accountAuthentication,
                                                       username,
                                                       password)
开发者ID:Chandler0591,项目名称:mygis,代码行数:21,代码来源:AISde.py

示例14: addFds

 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
开发者ID:Chandler0591,项目名称:mygis,代码行数:24,代码来源:AIWks.py

示例15: connect

    def connect(self):
        '''
         尝试连接数据库,  成功返回sde全路径
        '''
        connResult = None
        if not AIUtils.isEmpty(self.__sdeOutFullName):
            try:        
#                 sde_return = self.execute('select 1 from dual')
#                 if not AIUtils.isEmpty(sde_return):
#                     connResult = self.__sdeOutFullName
                connResult = self.__sdeOutFullName
            except:
                raise
#             except Exception as e:
#                 print 'failure, connect error'             
#                 print unicode(e.message).encode("utf-8") 
            
        return connResult
开发者ID:Chandler0591,项目名称:mygis,代码行数:18,代码来源:AISde.py


注:本文中的arccore.utils.AIUtils.AIUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。