本文整理汇总了Python中SSUtilities.returnPolygon方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.returnPolygon方法的具体用法?Python SSUtilities.returnPolygon怎么用?Python SSUtilities.returnPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.returnPolygon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setStudyArea
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnPolygon [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
示例2: initialize
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnPolygon [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)
#.........这里部分代码省略.........