POST
|
Hallo Python Community, I have a strange problem, i create 3D Polygons with Arcpy from a ASCII Textfile with Nodes, Edges and Triangles. Almost all triangles are created, 14 of 3644 Polygons are Empty. Lenght and Area are empty. I use ArcGIS Pro 1.4. One of this empty Polygons have this Coordinates: Point 1, Point 2, Point 3: 2574321,097 5696097,9 36,214 0 2574320,486 5696097,543 35,246 0 2574320,2 5696097,375 36,763 0 I know the coordinates are close together, but there are different. If I use the Method length3D he's also 0. Thank You for helping. Sorry for my bad English. import arcpy
import os
import sys
from arcpy import env
Input_Dude_Tin = arcpy.GetParameterAsText(0)
Workspace_Output = arcpy.GetParameterAsText(1)
Dataset_Output, Dataset_name = Workspace_Output.split(".gdb\\")
Dataset_Output = Dataset_Output+".gdb"
Polygon_Dataset = arcpy.CreateFeatureDataset_management(Dataset_Output, Dataset_name)
Input_Dude_Tin_List = Input_Dude_Tin.split(";")
for Input_Tin in Input_Dude_Tin_List:
t = os.path.basename(Input_Tin)
name_surface = t.split(".")[0]
out_path = Polygon_Dataset
out_name = name_surface
geometry_type = "POLYGON"
template = ""
has_m = "ENABLED"
has_z = "ENABLED"
Polygon_Feature_Class = arcpy.CreateFeatureclass_management(out_path, out_name, geometry_type, template,
has_m, has_z)
Input_Tin = Input_Tin.replace("'", "")
Surface1 = open(Input_Tin, "r")
Surface2 = open(Input_Tin, "r")
Surface3 = open(Input_Tin, "r")
array = arcpy.Array()
array12 = arcpy.Array()
array22 = arcpy.Array()
point = arcpy.Point()
for line in Surface1:
if (line.rsplit()[0]=="NODES"):
for line in Surface1:
if (line.rsplit()[0] == "EDGES"):
break
ID, X, Y, Z = line.split()
ID = int(ID)
X = float(X)
Y = float(Y)
Z = float(Z)
point = arcpy.Point(X,Y,Z,False,ID)
array.add(point)
for line in Surface2:
if (line.rsplit()[0] == "EDGES"):
for line in Surface2:
if (line.rsplit()[0] == "TRIANGLES"):
break
ID, Point1, Point2, M = line.split()
ID = int(ID)
Point1 = int(Point1)
Point2 = int(Point2)
array12.add(array.getObject(Point1-1))
array22.add(array.getObject(Point2-1))
# arcpy.FeatureToPolygon_management(Polyline_Feature_Class,Polygon_Feature_Class)
array3 = arcpy.Array()
for line in Surface3:
if (line.rsplit()[0] == "TRIANGLES"):
for line in Surface3:
ID, P1, P2, P3 = line.split()
ID = int(ID)
P1 = int(P1)
P2 = int(P2)
P3 = int(P3)
ID1 = array12.getObject(P1-1).ID
ID2 = array22.getObject(P1-1).ID
ID3 = array12.getObject(P2-1).ID
ID4 = array22.getObject(P2-1).ID
ID5 = array12.getObject(P3-1).ID
ID6 = array22.getObject(P3-1).ID
PointArray =([ID1,ID2,ID3,ID4,ID5,ID6])
PointSet = set(PointArray)
#arcpy.AddMessage(PointSet)
#arcpy.AddMessage("#######")
#array3.add(array12.getObject(P1-1))
#array3.add(array22.getObject(P1-1))
#array3.add(array12.getObject(P2-1))
#array3.add(array22.getObject(P2-1))
#array3.add(array12.getObject(P3-1))
#array3.add(array22.getObject(P3-1))
for e in PointSet:
array3.add(array.getObject(e-1))
polygon = arcpy.Polygon(array3, None, True, True)
polygon.M = ID
Polygon3DLenght = polygon.length3D
arcpy.AddField_management(Polygon_Feature_Class,'length3D', "FLOAT")
cursor = arcpy.da.InsertCursor(Polygon_Feature_Class, ['SHAPE@', 'length3D'])
cursor.insertRow([polygon,Polygon3DLenght])
array3.removeAll()
... View more
08-14-2017
09:57 AM
|
0
|
0
|
554
|
POST
|
I creates a Polygon with geometry and safe him in this GDB: C:\ArcGIS\Projects\Geologie\local_scene.gdb\aussrtm_Seligenstadt Than I want make the feature class "aussrtm_Seligenstadt" to a feature Layer and change his Color. The Source Code works he have no errors or faults. I think the problem: he creates the layer in the map after the tool is finished, This dosn't lyr.name == "test" work because the layer is in the map only after the tool is finished not during the tool is running He creates the layer in the tool and insert not until the end of tool.
... View more
07-27-2017
02:24 AM
|
0
|
2
|
1884
|
POST
|
Hello, i have trouble with ArcGIS Pro and arcpy. I want to make a feature layer, change his color and finally add him to the current Map My Problem is, this Syntax work in Python Window in ArcGIS Pro, but not in my selfmade Tool. Can someone help me. lyr = arcpy.MakeFeatureLayer_management(r"C:\ArcGIS\Projects\Geologie\local_scene.gdb\aussrtm_Seligenstadt","test")
aprx = arcpy.mp.ArcGISProject("CURRENT")
for m in aprx.listMaps():
for lyr in m.listLayers():
if lyr.name == "test":
sym = lyr.symbology
sym.renderer.symbol.color = {'RGB': [10, 10, 10, 255]}
lyr.symbology = sym
... View more
07-26-2017
04:33 AM
|
0
|
4
|
3256
|
POST
|
That is my Problem the only Attribute i have is the Elevation
... View more
11-17-2016
05:15 AM
|
0
|
0
|
1210
|
POST
|
Hello Esri Community, i have a problem with a 3D Polygon from a Triangulation, its to big, I want to simplify it. He is made of 450 000 Polygons. I will simplify it to 10 000 Polygons. "Aggregate Polygons" make always a one big polygon and for "Dissolve" I need attributes Can someone help me. Thank you for helping. Sorry for bad English!
... View more
11-17-2016
03:05 AM
|
0
|
5
|
1975
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|