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


Python SSUtilities.returnOutputFieldName方法代码示例

本文整理汇总了Python中SSUtilities.returnOutputFieldName方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.returnOutputFieldName方法的具体用法?Python SSUtilities.returnOutputFieldName怎么用?Python SSUtilities.returnOutputFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SSUtilities的用法示例。


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

示例1: output2NewFC

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnOutputFieldName [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)

#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:SSDataObject.py


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