Hi,
Get startX-StartY and EndX-EndY, of a polyline within a Class Featrure
I need to get startX-StartY and EndX-EndY, of a polyline within a Class Featrure, but must be for a specific polyline, ie for a given "ObjectID". So far I have the following code but I get no what I need.
On the other hand, if I comment the line if "ObjectID" == 50: get the points for all the polylines of feature class, and I just need to a specific ObjectID, eg 50.
Can you tell me what you're missing?
Thank you very much,
Gualberto
Get startX-StartY and EndX-EndY, of a polyline within a Class Featrure
I need to get startX-StartY and EndX-EndY, of a polyline within a Class Featrure, but must be for a specific polyline, ie for a given "ObjectID". So far I have the following code but I get no what I need.
On the other hand, if I comment the line if "ObjectID" == 50: get the points for all the polylines of feature class, and I just need to a specific ObjectID, eg 50.
Can you tell me what you're missing?
Thank you very much,
Gualberto
Code:
import arcpy
#infc = arcpy.GetParameterAsText(0)
inFeatures = "Database Connections\Con_GDBHuracanesHistoricos.sde\GDBCiclonesTropicales.SDE.Huracanes_Historicos\GDBCiclonesTropicales.SDE.Ciclones_Historicos"
# Enter for loop for each feature
#
for row in arcpy.da.SearchCursor(inFeatures, ["ObjectID", "SHAPE@"]):
# Print the current line ID
if "ObjectID" == 50:
print("Feature {0}:".format(row[0]))
#print "ObjectID"
#Set start point
startpt = row[1].firstPoint
#Set Start coordinates
startx = startpt.X
print startx
starty = startpt.Y
print starty
#Set end point
endpt = row[1].lastPoint
#Set End coordinates
endx = endpt.X
print endx
endy = endpt.Y
print endy