in ArcMap, I have (Points.shp) which has around 2000 points as shown:

enter image description here

And I have CSV file (let's call it Relation) which contains FromNode, ToNode (Relation of connecting points from-to)

enter image description here

Btw, The numbers in FromNode & ToNode refers to the id of the Points.shp

What I need is how to create (lines) which connecting these points based on the relation (From-To), using any tool, script, pyscript.


I believe you can accomplish this with the XY to Line geoprocessing tool. First you should add some fields to your relation table - x & y fields for the from and to nodes. This will give you your endpoints for each line you need to create. From there you can input the data into the XY to Line tool.

I found a great article regarding this from ESRI at https://support.esri.com/en/technical-article/000012092


I got the lines connecting the points as I want by:

First: For each point get XY coordinate.

Second: Join the relation table with the points table by FromNode and ID

Third: Join the relation table with the points tables again by ToNode and ID

Finally, Using "XY to Line" tool

enter image description here

The Result:

enter image description here

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.