本文整理汇总了Python中SSUtilities.increaseExtentByConstant方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.increaseExtentByConstant方法的具体用法?Python SSUtilities.increaseExtentByConstant怎么用?Python SSUtilities.increaseExtentByConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.increaseExtentByConstant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createOutput
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import increaseExtentByConstant [as 别名]
def createOutput(self, outputFC):
"""Creates an Output Feature Class with the Standard Distances.
INPUTS:
outputFC (str): path to the output feature class
"""
#### Validate Output Workspace ####
ERROR.checkOutputPath(outputFC)
#### Shorthand Attributes ####
ssdo = self.ssdo
caseField = self.caseField
#### Increase Extent if not Projected ####
if ssdo.spatialRefType != "Projected":
sdValues = self.sd.values()
if len(sdValues):
maxRadius = max(sdValues)
largerExtent = UTILS.increaseExtentByConstant(ssdo.extent,
constant = maxRadius)
largerExtent = [ LOCALE.str(i) for i in largerExtent ]
ARCPY.env.XYDomain = " ".join(largerExtent)
#### Create Output Feature Class ####
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
outPath, outName = OS.path.split(outputFC)
try:
DM.CreateFeatureclass(outPath, outName, "POLYGON",
"", ssdo.mFlag, ssdo.zFlag,
ssdo.spatialRefString)
except:
ARCPY.AddIDMessage("ERROR", 210, outputFC)
raise SystemExit()
#### Add Fields to Output FC ####
dataFieldNames = UTILS.getFieldNames(sdFieldNames, outPath)
shapeFieldNames = ["[email protected]"]
for fieldName in dataFieldNames:
UTILS.addEmptyField(outputFC, fieldName, "DOUBLE")
caseIsDate = False
if caseField:
fcCaseField = ssdo.allFields[caseField]
validCaseName = UTILS.validQFieldName(fcCaseField, outPath)
caseType = UTILS.convertType[fcCaseField.type]
UTILS.addEmptyField(outputFC, validCaseName, caseType)
dataFieldNames.append(validCaseName)
if caseType.upper() == "DATE":
caseIsDate = True
#### Write Output ####
badCaseRadians = []
allFieldNames = shapeFieldNames + dataFieldNames
rows = DA.InsertCursor(outputFC, allFieldNames)
for case in self.caseKeys:
#### Get Results ####
xVal, yVal = self.meanCenter[case]
radius = self.sd[case]
#### Create Empty Polygon Geomretry ####
poly = ARCPY.Array()
#### Check for Valid Radius ####
radiusZero = UTILS.compareFloat(0.0, radius, rTol = .0000001)
radiusNan = NUM.isnan(radius)
radiusBool = radiusZero + radiusNan
if radiusBool:
badRadian = 6
badCase = UTILS.caseValue2Print(case, self.caseIsString)
badCaseRadians.append(badCase)
else:
badRadian = 0
#### Calculate a Point For Each ####
#### Degree in Circle Polygon ####
for degree in NUM.arange(0, 360):
try:
radians = NUM.pi / 180.0 * degree
pntX = xVal + (radius * NUM.cos(radians))
pntY = yVal + (radius * NUM.sin(radians))
pnt = ARCPY.Point(pntX, pntY, ssdo.defaultZ)
poly.add(pnt)
except:
badRadian += 1
if badRadian == 6:
badCase = UTILS.caseValue2Print(case,
self.caseIsString)
badCaseRadians.append(badCase)
break
if badRadian < 6:
#### Create and Populate New Feature ####
poly = ARCPY.Polygon(poly, None, True)
rowResult = [poly, xVal, yVal, radius]
if caseField:
caseValue = case.item()
#.........这里部分代码省略.........
示例2: createOutput
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import increaseExtentByConstant [as 别名]
def createOutput(self, outputFC):
"""Creates an Output Feature Class with the Standard Distances.
INPUTS:
outputFC (str): path to the output feature class
"""
#### Validate Output Workspace ####
ERROR.checkOutputPath(outputFC)
#### Shorthand Attributes ####
ssdo = self.ssdo
caseField = self.caseField
#### Increase Extent if not Projected ####
if ssdo.spatialRefType != "Projected":
seValues = self.se.values()
if len(seValues):
maxSE = NUM.array([ i[0:2] for i in seValues ]).max()
largerExtent = UTILS.increaseExtentByConstant(ssdo.extent,
constant = maxSE)
largerExtent = [ LOCALE.str(i) for i in largerExtent ]
ARCPY.env.XYDomain = " ".join(largerExtent)
#### Create Output Feature Class ####
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
outPath, outName = OS.path.split(outputFC)
try:
DM.CreateFeatureclass(outPath, outName, "POLYGON",
"", ssdo.mFlag, ssdo.zFlag,
ssdo.spatialRefString)
except:
ARCPY.AddIDMessage("ERROR", 210, outputFC)
raise SystemExit()
#### Add Fields to Output FC ####
dataFieldNames = UTILS.getFieldNames(seFieldNames, outPath)
shapeFieldNames = ["[email protected]"]
for fieldName in dataFieldNames:
UTILS.addEmptyField(outputFC, fieldName, "DOUBLE")
caseIsDate = False
if caseField:
fcCaseField = ssdo.allFields[caseField]
validCaseName = UTILS.validQFieldName(fcCaseField, outPath)
caseType = UTILS.convertType[fcCaseField.type]
UTILS.addEmptyField(outputFC, validCaseName, caseType)
dataFieldNames.append(validCaseName)
if caseType.upper() == "DATE":
caseIsDate = True
#### Write Output ####
badCaseRadians = []
allFieldNames = shapeFieldNames + dataFieldNames
rows = DA.InsertCursor(outputFC, allFieldNames)
for case in self.caseKeys:
#### Get Results ####
xVal, yVal = self.meanCenter[case]
seX, seY, degreeRotation, radianR1, radianR2 = self.se[case]
seX2 = seX**2.0
seY2 = seY**2.0
#### Create Empty Polygon Geomretry ####
poly = ARCPY.Array()
#### Check for Valid Radius ####
seXZero = UTILS.compareFloat(0.0, seX, rTol = .0000001)
seXNan = NUM.isnan(seX)
seXBool = seXZero + seXNan
seYZero = UTILS.compareFloat(0.0, seY, rTol = .0000001)
seYNan = NUM.isnan(seY)
seYBool = seYZero + seYNan
if seXBool or seYBool:
badRadian = 6
badCase = UTILS.caseValue2Print(case, self.caseIsString)
badCaseRadians.append(badCase)
else:
badRadian = 0
cosRadian = NUM.cos(radianR1)
sinRadian = NUM.sin(radianR1)
#### Calculate a Point For Each ####
#### Degree in Ellipse Polygon ####
for degree in NUM.arange(0, 360):
try:
radians = UTILS.convert2Radians(degree)
tanVal2 = NUM.tan(radians)**2.0
dX = MATH.sqrt((seX2 * seY2) /
(seY2 + (seX2 * tanVal2)))
dY = MATH.sqrt((seY2 * (seX2 - dX**2.0)) /
seX2)
#### Adjust for Quadrant ####
if 90 <= degree < 180:
dX = -dX
elif 180 <= degree < 270:
dX = -dX
dY = -dY
#.........这里部分代码省略.........