本文整理汇总了Python中arccore.utils.AIUtils.AIUtils.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Python AIUtils.isEmpty方法的具体用法?Python AIUtils.isEmpty怎么用?Python AIUtils.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arccore.utils.AIUtils.AIUtils
的用法示例。
在下文中一共展示了AIUtils.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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")
示例2: __init__
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例3: __init__
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例4: __init__
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例5: __init__
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
def __init__(self, wksName, userName = None):
'''
构造器
'''
if not AIUtils.isEmpty(wksName):
arcpy.env.workspace = self.__wksName = wksName.replace('\\', '/')
self.__userName = userName
示例6: queryFdsList
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例7: execute
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例8: publish
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例9: __init__
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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)
示例10: queryFds
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例11: setFields
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [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
示例12: queryFcList
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
def queryFcList(self, fc):
'''
查询要素类列表
'''
qrs = []
if isinstance(fc, AIFc):
name = fc.getName()
ftype = fc.getFtype()
ftype = 'All' if AIUtils.isEmpty(ftype) else ftype
fds = fc.getFds()
# 要素集名称
fdsName = None
if not AIUtils.isEmpty(fds) and isinstance(fds, AIFds) and not AIUtils.isEmpty(fds.getName()):
fdsName = fds.getName()
fdsName = fdsName if ('.' in fdsName) else fdsName if AIUtils.isEmpty(self.__userName) else (self.__userName + '.') + fdsName
fds = self.queryFds(fds)
featureclasses = arcpy.ListFeatureClasses(None if AIUtils.isEmpty(name) else ('*'+ name + '*'), ftype, fdsName)
for featureclass in featureclasses:
desc = arcpy.Describe(featureclass)
flds = []
for field in desc.fields:
fld = AIFld(AIUtils.unicode2utf8(field.name), AIUtils.unicode2utf8(field.aliasName), \
AIUtils.unicode2utf8(field.type), field.scale, \
field.length, field.isNullable)
flds.append(fld)
qrs.append(AIFc(AIUtils.unicode2utf8(desc.name), AIUtils.unicode2utf8(desc.aliasName), \
AIUtils.unicode2utf8(desc.shapeType), None if AIUtils.isEmpty(desc.spatialReference) else desc.spatialReference.factoryCode, \
fds, flds))
else:
raise Exception('input parameter type not correct!')
return qrs
示例13: connect
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
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
示例14: toStr
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [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
示例15: removeFds
# 需要导入模块: from arccore.utils.AIUtils import AIUtils [as 别名]
# 或者: from arccore.utils.AIUtils.AIUtils import isEmpty [as 别名]
def removeFds(self, fds):
'''
删除要素集
'''
flag = False
if isinstance(fds, AIFds):
name = fds.getName()
if not AIUtils.isEmpty(name):
if arcpy.Exists(name):
try:
arcpy.Delete_management(name)
flag = True
except:
raise
else:
raise Exception('dataset not exist!')
else:
raise Exception('dataset name cannot be empty!')
else:
raise Exception('input parameter type not correct!')
return flag