本文整理汇总了Python中arcpy.Array方法的典型用法代码示例。如果您正苦于以下问题:Python arcpy.Array方法的具体用法?Python arcpy.Array怎么用?Python arcpy.Array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arcpy
的用法示例。
在下文中一共展示了arcpy.Array方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: vertical
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def vertical(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):
count = 1.0
while count < divisions:
a = float(TLX*((divisions-count)/divisions) + TRX*(count/divisions)) + float(overflow)
b = float(TLY*((divisions-count)/divisions) + TRY*(count/divisions)) + float(overflow)
c = float(BLX*((divisions-count)/divisions) + BRX*(count/divisions)) - float(overflow)
d = float(BLY*((divisions-count)/divisions) + BRY*(count/divisions)) - float(overflow)
T2B = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
T2B_line = arcpy.Polyline(T2B)
insert_cursor.insertRow((T2B_line,))
count += 1.0
示例2: horizontal
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def horizontal(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):
count = 1.0
while count < divisions:
a = float(TLX*((divisions-count)/divisions) + BLX*(count/divisions)) - float(overflow)
b = float(TLY*((divisions-count)/divisions) + BLY*(count/divisions)) - float(overflow)
c = float(TRX*((divisions-count)/divisions) + BRX*(count/divisions)) + float(overflow)
d = float(TRY*((divisions-count)/divisions) + BRY*(count/divisions)) + float(overflow)
L2R = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
L2R_line = arcpy.Polyline(L2R)
insert_cursor.insertRow((L2R_line,))
count += 1.0
示例3: make_poly_from_extent
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def make_poly_from_extent(ext, sr):
"""Make an arcpy polygon object from an input extent object.,Returns
a polygon geometry object.
Required:
ext -- extent object
sr -- spatial reference
Example
>>> ext = arcpy.Describe(fc).extent
>>> sr = 4326 #WKID for WGS 84
>>> poly = make_poly_from_extent(ext, sr)
>>> arcpy.CopyFeatures_management(poly, r'C:\Temp\Project_boundary.shp')
"""
array = arcpy.Array()
array.add(ext.lowerLeft)
array.add(ext.lowerRight)
array.add(ext.upperRight)
array.add(ext.upperLeft)
array.add(ext.lowerLeft)
return arcpy.Polygon(array, sr)
示例4: execute
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def execute(in_datasets, out_fc):
# use gcs as output sr since all extents will fit in it
out_sr = arcpy.SpatialReference("WGS 1984")
in_datasets = in_datasets.split(";")
arcpy.CreateFeatureclass_management(os.path.dirname(out_fc),
os.path.basename(out_fc),
"POLYGON",
spatial_reference=out_sr)
arcpy.AddField_management(out_fc, "dataset", "TEXT", 400)
# add each dataset's extent & the dataset's name to the output
with arcpy.da.InsertCursor(out_fc, ("SHAPE@", "dataset")) as cur:
for i in in_datasets:
d = arcpy.Describe(i)
ex = d.Extent
pts = arcpy.Array([arcpy.Point(ex.XMin, ex.YMin),
arcpy.Point(ex.XMin, ex.YMax),
arcpy.Point(ex.XMax, ex.YMax),
arcpy.Point(ex.XMax, ex.YMin),
arcpy.Point(ex.XMin, ex.YMin),])
geom = arcpy.Polygon(pts, d.SpatialReference)
if d.SpatialReference != out_sr:
geom = geom.projectAs(out_sr)
cur.insertRow([geom, d.CatalogPath])
示例5: qq
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def qq(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):
count = 1.0
while count < divisions:
a = float(TLX*((divisions-count)/divisions) + TRX*(count/divisions)) + float(overflow)
b = float(TLY*((divisions-count)/divisions) + TRY*(count/divisions)) + float(overflow)
c = float(BLX*((divisions-count)/divisions) + BRX*(count/divisions)) - float(overflow)
d = float(BLY*((divisions-count)/divisions) + BRY*(count/divisions)) - float(overflow)
e = float(TLX*((divisions-count)/divisions) + BLX*(count/divisions)) - float(overflow)
f = float(TLY*((divisions-count)/divisions) + BLY*(count/divisions)) - float(overflow)
g = float(TRX*((divisions-count)/divisions) + BRX*(count/divisions)) + float(overflow)
h = float(TRY*((divisions-count)/divisions) + BRY*(count/divisions)) + float(overflow)
T2B = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
L2R = arcpy.Array([arcpy.Point(e, f), arcpy.Point(g, h)])
T2B_line = arcpy.Polyline(T2B)
L2R_line = arcpy.Polyline(L2R)
insert_cursor.insertRow((T2B_line,))
insert_cursor.insertRow((L2R_line,))
count += 1.0
示例6: q
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def q(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):
count = 1.0
while count < divisions:
a = float(TLX*((divisions-count)/divisions) + TRX*(count/divisions)) + float(overflow)
b = float(TLY*((divisions-count)/divisions) + TRY*(count/divisions)) + float(overflow)
c = float(BLX*((divisions-count)/divisions) + BRX*(count/divisions)) - float(overflow)
d = float(BLY*((divisions-count)/divisions) + BRY*(count/divisions)) - float(overflow)
e = float(TLX*((divisions-count)/divisions) + BLX*(count/divisions)) - float(overflow)
f = float(TLY*((divisions-count)/divisions) + BLY*(count/divisions)) - float(overflow)
g = float(TRX*((divisions-count)/divisions) + BRX*(count/divisions)) + float(overflow)
h = float(TRY*((divisions-count)/divisions) + BRY*(count/divisions)) + float(overflow)
T2B = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
L2R = arcpy.Array([arcpy.Point(e, f), arcpy.Point(g, h)])
T2B_line = arcpy.Polyline(T2B)
L2R_line = arcpy.Polyline(L2R)
insert_cursor.insertRow((T2B_line,))
insert_cursor.insertRow((L2R_line,))
count += 1.0
示例7: asShape
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Array [as 别名]
def asShape(self):
"""Returns JSON as arcpy.Geometry() object."""
if self.geometryType != ESRI_ENVELOPE:
return arcpy.AsShape(self.json, True)
else:
ar = arcpy.Array([
arcpy.Point(self.json[XMIN], self.json[YMAX]),
arcpy.Point(self.json[XMAX], self.json[YMAX]),
arcpy.Point(self.json[XMAX], self.json[YMIN]),
arcpy.Point(self.json[XMIN], self.json[YMIN])
])
return arcpy.Polygon(ar, arcpy.SpatialReference(self.spatialReference))