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


Python SSUtilities.clearExtent方法代码示例

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


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

示例1: setStudyArea

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import clearExtent [as 别名]
    def setStudyArea(self):
        """Sets the study area for the nearest neighbor stat."""

        #### Attribute Shortcuts ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84248))
        ssdo = self.ssdo

        if self.studyArea == None:
            #### Create Min Enc Rect ####
            studyAreaFC = UTILS.returnScratchName("regularBound_FC")
            clearedMinBoundGeom = UTILS.clearExtent(UTILS.minBoundGeomPoints)
            clearedMinBoundGeom(ssdo.xyCoords, studyAreaFC, 
                                geomType = "RECTANGLE_BY_AREA",
                                spatialRef = ssdo.spatialRef)
            polyInfo = UTILS.returnPolygon(studyAreaFC, 
                                           spatialRef = ssdo.spatialRefString,
                                           useGeodesic = ssdo.useChordal)
            studyAreaPoly, studyArea = polyInfo
            UTILS.passiveDelete(studyAreaFC)

            if studyArea == None:
                #### Invalid Study Area ####
                ARCPY.AddIDMessage("Error", 932)
                raise SystemExit()

            self.studyArea = studyArea 
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:28,代码来源:NearestNeighbor.py

示例2: createOutput

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import clearExtent [as 别名]
    def createOutput(self, outputFC):
        """Creates an Output Feature Class with the Directional Mean
        Results.

        INPUTS:
        outputFC (str): path to the output feature class
        """

        #### Validate Output Workspace ####
        ERROR.checkOutputPath(outputFC)

        #### Shorthand Attributes ####
        ssdo = self.ssdo
        caseField = self.caseField

        #### Create Output Feature Class ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
        tempCFLayer = "tmpCFLayer"

        try:
            DM.MakeFeatureLayer(ssdo.inputFC, tempCFLayer)
            first = True
            for key, value in self.cf.iteritems():
                oids = value[0]
                for oid in oids:
                    sqlString = ssdo.oidName + '=' + str(oid)
                    if first:
                        DM.SelectLayerByAttribute(tempCFLayer, 
                                                  "NEW_SELECTION",
                                                  sqlString)
                        first = False
                    else:
                        DM.SelectLayerByAttribute(tempCFLayer,
                                                  "ADD_TO_SELECTION", 
                                                  sqlString)

            UTILS.clearExtent(DM.CopyFeatures(tempCFLayer, outputFC))
        except:
            ARCPY.AddIDMessage("ERROR", 210, outputFC)
            raise SystemExit()

        #### Set Attribute ####
        self.outputFC = outputFC
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:45,代码来源:CentralFeature.py

示例3: setupOptHotSpot

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import clearExtent [as 别名]
def setupOptHotSpot():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    #### Input Parameters ####
    inputFC = ARCPY.GetParameterAsText(0)
    outputFC = ARCPY.GetParameterAsText(1)
    varName = UTILS.getTextParameter(2, fieldName = True)
    aggMethod = UTILS.getTextParameter(3)
    if aggMethod:
        aggType = aggTypes[aggMethod.upper()]
    else:
        aggType = 1
    boundaryFC = UTILS.getTextParameter(4)
    polygonFC = UTILS.getTextParameter(5)
    outputRaster = UTILS.getTextParameter(6)


    makeFeatureLayerNoExtent = UTILS.clearExtent(DM.MakeFeatureLayer)
    selectLocationNoExtent = UTILS.clearExtent(DM.SelectLayerByLocation)
    featureLayer = "InputOHSA_FC"
    makeFeatureLayerNoExtent(inputFC, featureLayer)
    if boundaryFC:
        selectLocationNoExtent(featureLayer, "INTERSECT",
                                 boundaryFC, "#",
                                 "NEW_SELECTION")
        polygonFC = None

    if polygonFC:
        selectLocationNoExtent(featureLayer, "INTERSECT",
                                 polygonFC, "#",
                                 "NEW_SELECTION")
        boundaryFC = None

    #### Create SSDO ####
    ssdo = SSDO.SSDataObject(featureLayer, templateFC = outputFC, 
                             useChordal = True)

    hs = OptHotSpots(ssdo, outputFC, varName = varName, aggType = aggType,
                      polygonFC = polygonFC, boundaryFC = boundaryFC,
                      outputRaster = outputRaster)

    DM.Delete(featureLayer)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:45,代码来源:OptimizedHotSpotAnalysis.py

示例4: calculateAreas

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import clearExtent [as 别名]
def calculateAreas(inputFC, outputFC):
    """Creates a new feature class from the input polygon feature class 
    and adds a field that includes the area of the polygons.

    INPUTS:
    inputFC (str): path to the input feature class
    outputFC (str): path to the output feature class
    """

    #### Validate Output Workspace ####
    ERROR.checkOutputPath(outputFC)
    outPath, outName = OS.path.split(outputFC)

    #### Create SSDataObject ####
    ssdo = SSDO.SSDataObject(inputFC, templateFC = outputFC,
                             useChordal = False)

    #### Assure Polygon FC ####
    if ssdo.shapeType.lower() != "polygon":
        ARCPY.AddIDMessage("ERROR", 931)
        raise SystemExit()

    #### Check Number of Observations ####
    cnt = UTILS.getCount(inputFC)
    ERROR.errorNumberOfObs(cnt, minNumObs = 1)

    #### Copy Features ####
    try:
        clearCopy = UTILS.clearExtent(DM.CopyFeatures)
        clearCopy(inputFC, outputFC)
    except:
        ARCPY.AddIDMessage("ERROR", 210, outputFC)
        raise SystemExit()

    #### Add Area Field ####
    areaFieldNameOut = ARCPY.ValidateFieldName(areaFieldName, outPath)
    if not ssdo.allFields.has_key(areaFieldNameOut): 
        UTILS.addEmptyField(outputFC, areaFieldNameOut, "DOUBLE")

    #### Calculate Field ####
    clearCalc = UTILS.clearExtent(DM.CalculateField)
    clearCalc(outputFC, areaFieldNameOut, "!shape.area!", "PYTHON_9.3")
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:44,代码来源:CalculateAreas.py

示例5: output2NewFC

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import clearExtent [as 别名]

#.........这里部分代码省略.........
                    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)

        #### Do FC2FC Without Extent Env Var ####
        FC2FC = UTILS.clearExtent(CONV.FeatureClassToFeatureClass)
        try:
            FC2FC(self.inputFC, outPath, outName, "", outputFieldMaps)
        except:
            ARCPY.AddIDMessage("ERROR", 210, self.outputFC)
            raise SystemExit()

        #### Create/Verify Result Field Order ####
        fieldKeys = candidateFields.keys()
        fieldKeys.sort()
        if len(fieldOrder) == len(fieldKeys):
            fKeySet = set(fieldKeys)
            fieldOrderSet = set(fieldOrder)
            if fieldOrderSet == fKeySet:
                fieldKeys = fieldOrder

            del fKeySet, fieldOrderSet

        #### Add Empty Output Analysis Fields ####
        outputFieldNames = [masterOutName]
        for fieldInd, fieldName in enumerate(fieldKeys):
            field = candidateFields[fieldName]
            field.copy2FC(outputFC)
            outputFieldNames.append(fieldName)

            #### Replace NaNs for Shapefiles ####
            if outIsShapeFile:
                if field.type != "TEXT":
                    isNaN = NUM.isnan(field.data)
                    if NUM.any(isNaN):
                        field.data[isNaN] = UTILS.shpFileNull[field.type]

        #### Populate Output Feature Class with Values ####
        ARCPY.SetProgressor("step", ARCPY.GetIDMessage(84003),
                            0, self.numObs, 1)
        outRows = DA.UpdateCursor(self.outputFC, outputFieldNames)

        for row in outRows:
            masterID = row[0]
            if self.master2Order.has_key(masterID):
                order = self.master2Order[masterID]

                #### Create Output Row from Input ####
                resultValues = [masterID]

                #### Add Result Values ####
                for fieldName in fieldKeys:
                    field = candidateFields[fieldName]
                    fieldValue = field.data.item(order)
                    resultValues.append(fieldValue)

                #### Insert Values into Output ####
                outRows.updateRow(resultValues)

            else:
                #### Bad Record ####
                outRows.deleteRow()

            ARCPY.SetProgressorPosition()

        #### Clean Up ####
        del outRows
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:104,代码来源:SSDataObject.py

示例6: initialize

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import clearExtent [as 别名]
    def initialize(self):
        """Reads data into a GA structure for neighborhood searching and
        sets the study area envelope."""

        #### Shorthand Attributes ####
        ssdo = self.ssdo
        weightField = self.weightField
        if weightField:
            fieldList = [weightField]
        else:
            fieldList = []

        #### Create GA Data Structure ####
        ssdo.obtainDataGA(ssdo.oidName, fieldList, minNumObs = 3, 
                          warnNumObs = 30)
        N = len(ssdo.gaTable)

        #### Get Weights ####
        if weightField:
            weights = ssdo.fields[weightField].returnDouble()
            #### Report No Weights ####
            weightSum = weights.sum()
            if not weightSum > 0.0: 
                ARCPY.AddIDMessage("ERROR", 898)
                raise SystemExit()

        
        #### Set Study Area ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84248))
        clearedMinBoundGeom = UTILS.clearExtent(UTILS.minBoundGeomPoints)

        #### Set Initial Study Area FC ####
        if self.studyAreaMethod == 1 and self.studyAreaFC:
            #### Assure Only A Single Polygon in Study Area FC ####
            polyCount = UTILS.getCount(self.studyAreaFC)
            if polyCount != 1:
                ARCPY.AddIDMessage("ERROR", 936)
                raise SystemExit()
            self.tempStudyArea = False

            #### Read User Provided Study Area ####
            polyInfo = UTILS.returnPolygon(self.studyAreaFC, 
                                           spatialRef = ssdo.spatialRefString)
            self.studyAreaPoly, self.studyArea = polyInfo

            #### Create Temp Min. Enc. Rectangle and Class ####
            tempMBG_FC = UTILS.returnScratchName("tempMBG_FC")
            clearedMinBoundGeom(self.studyAreaPoly, tempMBG_FC, 
                                geomType = "RECTANGLE_BY_AREA",
                                spatialRef = ssdo.spatialRef)
            self.minRect = UTILS.MinRect(tempMBG_FC)
            UTILS.passiveDelete(tempMBG_FC)

        else:
            #### Create Min. Enc. Rectangle ####
            self.studyAreaFC = UTILS.returnScratchName("regularBound_FC")
            self.tempStudyArea = True
            clearedMinBoundGeom(ssdo.xyCoords, self.studyAreaFC, 
                                geomType = "RECTANGLE_BY_AREA",
                                spatialRef = ssdo.spatialRef)
            polyInfo = UTILS.returnPolygon(self.studyAreaFC, 
                                           spatialRef = ssdo.spatialRefString)
            self.studyAreaPoly, self.studyArea = polyInfo

            #### Create Min. Enc. Rectangle Class ####
            self.minRect = UTILS.MinRect(self.studyAreaFC)

            if self.reduce:
                #### Only Need To Create FC if Reduce Buffer ####
                UTILS.createPolygonFC(self.studyAreaFC, self.studyAreaPoly, 
                                      spatialRef = ssdo.spatialRefString)


        #### Set Extent and Envelope and Min Rect ####
        self.envelope = UTILS.Envelope(ssdo.extent)
        self.maxDistance = self.minRect.maxLength * 0.25
        if self.maxDistance > (self.minRect.minLength * .5):
            #### 25% of Max Extent is Larger Than Half Min Extent ####
            #### Results in Reduced Study Area Failure ####
            if self.reduce:
                self.maxDistance = self.minRect.minLength * 0.25

        #### Determine Distance Increment ####
        if not self.dIncrement:
            if self.begDist: 
                distRange = self.maxDistance - self.begDist
            else: 
                distRange = self.maxDistance
            self.dIncrement = float(distRange / self.nIncrements)

        #### Determine Starting Distance ####
        if not self.begDist:
            self.begDist = self.dIncrement
        
        #### Determine All Distance Cutoffs ####
        rangeInc = xrange(self.nIncrements)
        cutoffs = []
        for inc in rangeInc:
            val = (inc * self.dIncrement) + self.begDist
            cutoffs.append(val)
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:KFunction.py


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