本文整理汇总了Python中SSUtilities.getBaseWorkspaceType方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.getBaseWorkspaceType方法的具体用法?Python SSUtilities.getBaseWorkspaceType怎么用?Python SSUtilities.getBaseWorkspaceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.getBaseWorkspaceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: output2NewFC
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getBaseWorkspaceType [as 别名]
def output2NewFC(self, outputFC, candidateFields, appendFields = [],
fieldOrder = []):
"""Creates a new feature class with the same shape charcteristics as
the source input feature class and appends data to it.
INPUTS:
outputFC (str): catalogue path to output feature class
candidateFields (dict): fieldName = instance of CandidateField
appendFields {list, []}: field names in the order you want appended
fieldOrder {list, []}: the order with which to write fields
"""
#### Initial Progressor Bar ####
ARCPY.overwriteOutput = True
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84006))
#### Validate Output Workspace ####
ERROR.checkOutputPath(outputFC)
#### Create Path for Output FC ####
outPath, outName = OS.path.split(outputFC)
#### Get Output Name for SDE if Necessary ####
baseType = UTILS.getBaseWorkspaceType(outPath)
if baseType.upper() == 'REMOTEDATABASE':
outName = outName.split(".")[-1]
self.outputFC = OS.path.join(outPath, outName)
#### Assess Whether to Honor Original Field Nullable Flag ####
setNullable = UTILS.setToNullable(self.catPath, self.outputFC)
#### Add Null Value Flag ####
outIsShapeFile = UTILS.isShapeFile(self.outputFC)
#### Create Output Field Names to be Appended From Input ####
inputFieldNames = ["[email protected]", self.masterField]
appendFieldNames = []
masterIsOID = self.masterField == self.oidName
if masterIsOID:
appendFieldNames.append("SOURCE_ID")
else:
master = self.allFields[self.masterField.upper()]
returnName = UTILS.returnOutputFieldName(master)
appendFieldNames.append(returnName)
for fieldName in appendFields:
field = self.allFields[fieldName.upper()]
returnName = UTILS.returnOutputFieldName(field)
inputFieldNames.append(fieldName)
appendFieldNames.append(returnName)
appendFieldNames = UTILS.createAppendFieldNames(appendFieldNames,
outPath)
masterOutName = appendFieldNames[0]
#### Create Field Mappings for Visible Fields ####
outputFieldMaps = ARCPY.FieldMappings()
#### Add Input Fields to Output ####
for ind, fieldName in enumerate(appendFieldNames):
if ind == 0:
#### Master Field ####
sourceFieldName = self.masterField
if masterIsOID:
fieldType = "LONG"
alias = fieldName
setOutNullable = False
fieldLength = None
fieldPrecision = None
else:
masterOutField = self.allFields[self.masterField.upper()]
fieldType = masterOutField.type
alias = masterOutField.baseName
setOutNullable = setNullable
fieldLength = masterOutField.length
fieldPrecision = masterOutField.precision
else:
#### Append Fields ####
sourceFieldName = appendFields[ind-1]
outField = self.allFields[sourceFieldName]
fieldType = outField.type
alias = outField.baseName
setOutNullable = setNullable
fieldLength = outField.length
fieldPrecision = outField.precision
#### Create Candidate Field ####
outCandidate = CandidateField(fieldName, fieldType, None,
alias = alias,
precision = fieldPrecision,
length = fieldLength)
#### Create Output Field Map ####
outFieldMap = UTILS.createOutputFieldMap(self.inputFC,
sourceFieldName,
outFieldCandidate = outCandidate,
setNullable = setOutNullable)
#### Add Output Field Map to New Field Mapping ####
outputFieldMaps.addFieldMap(outFieldMap)
#.........这里部分代码省略.........