Select to view content in your preferred language

How to copy points information to an edge feature

536
3
Jump to solution
11-08-2022 04:54 AM
ConnieSu
Emerging Contributor

Hello! I have a points feature class (named "BR_RG_Imediatas_2021_MeanCenter"), in which I used the tools "Create TIN" and "TIN Edge" to create an edge feature class (named "SC_TIN_TinEdge") that connects these points using Delaunay Triangulation. Please refer to the picture below.

2022-11-08.png

The edges represent railway stretches and the points represent railway terminals. I need to build an heuristic, in which I'm going to select some edges and points, representing a new railway, and then I'm going to build the network dataset and run the route solver.

To build the heuristics' solution, I was thinking of creating two fields in the "SC_TIN_TinEdge" edges feature, one with the edge's start point ID and another field with the edge's end point ID in  the "BR_RG_Imediatas_2021_MeanCenter" points feature. with this information, I know which edges are connected.

For instance, the first edge (OBJECTID=1) starts with the point with OBJECTID=4 and ends with OBJECTID=10. The second edge (OBJECTID=2) also starts with the point with OBJECTID=4, but ends with point OBJECTID=5 (please refer to the pictures below).

2022-11-08 (7).png2022-11-08 (6).png

Please, do you know hw can I create these two points' ID fields in the edges feature class in an automatic way?

Thanks and regards!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DanLee
by Esri Regular Contributor
Esri Regular Contributor

You can try the following. I will shorten the input names to Points (railway terminals) and Lines (TIN edges) for simplicity. 

1. Run Feature Vertices To Points tool on the Lines with the "Start vertex" as the Point Type. The output, say StartVerts, contains start points of each line with an ORIG_FID field, i.e. original line feature ID field.

2. Run Feature Vertices To Points tool on Lines with the "End vertex" as the Point Type. The output, say EndVerts, contains end points of each line with an ORIG_FID field, i.e. original line feature ID field.

3. Run Near tool on StartVerts with Points as the Near Features. This will add NEAR_FID and NEAR_DIST fields to StartVerts table.

4. Run Join Field tool on StartVerts, joining Points via the common fields, NEAR_FID and OBJECTID respectively, to transfer OBJECTID (or point feature ID) from Points to StartVerts.

5. Use Alter Field tool to rename the transferred point feature ID to StartPtID.

6. Run Join Field tool on Lines, joining StartVerts via the common fields OBJECTID and ORIG__FID, to transfer StartPtID to Lines.

7. Repeat steps 3 - 6 for EndVerts to obtain EndPtID from Points, and then transfer EndPtID to Lines.

Now the Lines should have both StartPtID and EndPtID fields.

Hope this will work for you without writing code.

You may use Spatial Join to replace steps 3-5, which creates a new output with "transferred" field from Points via Field Map parameter. But that may take longer time to learn and figure out, if you are not familiar with Spatial Join tool.

View solution in original post

0 Kudos
3 Replies
DanLee
by Esri Regular Contributor
Esri Regular Contributor

You can try the following. I will shorten the input names to Points (railway terminals) and Lines (TIN edges) for simplicity. 

1. Run Feature Vertices To Points tool on the Lines with the "Start vertex" as the Point Type. The output, say StartVerts, contains start points of each line with an ORIG_FID field, i.e. original line feature ID field.

2. Run Feature Vertices To Points tool on Lines with the "End vertex" as the Point Type. The output, say EndVerts, contains end points of each line with an ORIG_FID field, i.e. original line feature ID field.

3. Run Near tool on StartVerts with Points as the Near Features. This will add NEAR_FID and NEAR_DIST fields to StartVerts table.

4. Run Join Field tool on StartVerts, joining Points via the common fields, NEAR_FID and OBJECTID respectively, to transfer OBJECTID (or point feature ID) from Points to StartVerts.

5. Use Alter Field tool to rename the transferred point feature ID to StartPtID.

6. Run Join Field tool on Lines, joining StartVerts via the common fields OBJECTID and ORIG__FID, to transfer StartPtID to Lines.

7. Repeat steps 3 - 6 for EndVerts to obtain EndPtID from Points, and then transfer EndPtID to Lines.

Now the Lines should have both StartPtID and EndPtID fields.

Hope this will work for you without writing code.

You may use Spatial Join to replace steps 3-5, which creates a new output with "transferred" field from Points via Field Map parameter. But that may take longer time to learn and figure out, if you are not familiar with Spatial Join tool.

0 Kudos
ConnieSu
Emerging Contributor

Thanks Dan! It worked perfectly!

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

You are welcome, Connie! I am glad it worked for you.  🙂

0 Kudos