Sunday, 13 October 2019

Getting First and Last Point coordinates of Polyline with Field Calculator in ArcGIS Desktop?



I'm trying to get the First Point coordinates (x,y) and Final Point coordinates (x2,y2) from a polyline in ArcGIS 10 with the Field calculator.


I've added 4 (double) fields like StartX,StartY,EndX and EndY,I tried with:


"!Shape!.positionAlongLine(0.0,True).firstPoint.X"
"!Shape!.positionAlongLine(0.0,True).firstPoint.Y"
"!Shape!.positionAlongLine(1.0,True).firstPoint.X"
"!Shape!.positionAlongLine(1.0,True).firstPoint.Y"

But no luck. The error: "The row contains a bad value".


What am I doing wrong?


Thanks to @radouxju for your answer because it was what I was looking for!!, but NOW I don't know What's happening with my ArcGIS10. Let's see:



I could compute all these statements (4), to every field:



  • "!Shape!.lastPoint.X"

  • "!Shape!.lastPoint.Y"...


But, after that I checked for errors and I found this! That there are times that the ArcGIS field calculator doesn't compute well. In the example, the yellow one, it's 16 meter long, but its coordinates are the same, but the the next polyline is well computed... What's happening?


Error with ArcGIS10




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...