0

I have generated a road network from open street map data. How can i add start and end coordinates (point_x, point_y) to its attributes table via toolbox or arcpy? enter image description here That's how the roads look like. I also have the shapefile, but i believe this should be more appropriate, since the junctions i need are already identified.

2

Use the field calculator. If you have a field (like start_x), use the field calculator with the expression !SHAPE!.firstPoint.X, and for a field like end_x you would use !SHAPE!.lastPoint.X. for your Y coordinates, you would use !SHAPE!.firstPoint.Y and !SHAPE!.lastPoint.Y

Check out the arcpy geometry documentation(http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-classes/geometry.htm). firstPoint and lastPoint return Point objects, which you can read about here: http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-classes/point.htm

EDIT: you have to use the Python parser, at the top of the field calculator window

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.