Select to view content in your preferred language

# Split line at point yields lines ordered incorrectly

1392
5
01-27-2014 10:48 AM
New Contributor
I have a line that has points evenly spaced on the line. The points are numbered in increasing order along the line. When I use Split Line at Points, my line segments are not ordered with the points. They are appear to be randomly ordered.
Is there someway to fix this? I need to at least have the lines numbered such that they are numbered in order so I can extract data to other programs.

If this isn't possible, is there a way to create an attribute for each line segment that is equal to the average of the points that are connected to each end of the line.

Thanks
Tags (3)
5 Replies
Frequent Contributor III
I think your best best will be to calculate the x,y values of your points on your lines.  Then in Excel sort your points from low to high and whatever designates a particular line.  Call them something like FromX and FromY

For example if it is line called  XXY  sort it Linename and then your sort.

at the end of  cell create ToX and ToY

for the example.

LineName column A
Sort        column B
FromX     column C
FromY     column D
ToX        column E
ToY        column F

in E2 (ToX first blank cell under the headers)

=if((A2=A3),C3,"")

This will say IF linename for point 1 is the same as point 2 then populate the ToX with the FromX of the 2nd point.  If not leave it blank.  You can then fill in the rest of the rows by dragging it down.  If done correctly you should see blank values for ToX and ToY at all the end points.  Fill in appropriately for ToY and drag it in.

Now save it as a .csv.  this will write the values into the cells and remove the formulas.  Then open it back up in excel and delete all the rows with no values in the ToX and ToY

Bring the spreadsheet into ArcGIS and use the XY to Line tool and it will build your polylines in correct sorted order and you can attribute them as you wish.

This does work.  I  had to create 65000 some spans between all of our transmission structures in our system in sequential order from Structure 1 to whatever on each different line.

I have a line that has points evenly spaced on the line. The points are numbered in increasing order along the line. When I use Split Line at Points, my line segments are not ordered with the points. They are appear to be randomly ordered.
Is there someway to fix this? I need to at least have the lines numbered such that they are numbered in order so I can extract data to other programs.

If this isn't possible, is there a way to create an attribute for each line segment that is equal to the average of the points that are connected to each end of the line.

Thanks
MVP Honored Contributor
I have a line that has points evenly spaced on the line. The points are numbered in increasing order along the line. When I use Split Line at Points, my line segments are not ordered with the points. They are appear to be randomly ordered.
Is there someway to fix this? I need to at least have the lines numbered such that they are numbered in order so I can extract data to other programs.

If this isn't possible, is there a way to create an attribute for each line segment that is equal to the average of the points that are connected to each end of the line.

Thanks

Spatial Join the points to the lines with the lines as your primary target.  Use the One to One option and get the average of the point IDs (modify the field list summary options for the point number field) assigned to the lines and then sort the lines according to the original line ID and the averaged Point IDs.  Truncate the fractional portion if you wanted the numbers to match the point at the beginning of the line (assuming you have a point at the beginning).  This assumes no points exist at the intersection of two or more lines.  If that was possible I would apply the process iteratively for one line and matching point set at a time or use my second option.

I would alternatively use linear referencing for this.  The Create Route tool can assign measures along the line in a way that matched the arrangement of your points.  You would need points at each line end for this to work.  Then I would use the Located Features Along Route tool to match up the points to the line in an event table.  Then I would copy the event table, subtract 1 from each point number and merge the two tables.  Then I would get the Summary Statistics with the unique case being for each Route ID and Point Number and get the Min and Max of the measures of the points.  This creates a line table that can be Sorted by Point ID or Min or Max measure to sequence the way you want.  Export the line events to actual lines if you need to.
New Contributor
I'm very confused by this. How to I obtain the XY coordinates for the points or the lines?

I think your best best will be to calculate the x,y values of your points on your lines.  Then in Excel sort your points from low to high and whatever designates a particular line.  Call them something like FromX and FromY

For example if it is line called  XXY  sort it Linename and then your sort.

at the end of  cell create ToX and ToY

for the example.

LineName column A
Sort        column B
FromX     column C
FromY     column D
ToX        column E
ToY        column F

in E2 (ToX first blank cell under the headers)

=if((A2=A3),C3,"")

This will say IF linename for point 1 is the same as point 2 then populate the ToX with the FromX of the 2nd point.  If not leave it blank.  You can then fill in the rest of the rows by dragging it down.  If done correctly you should see blank values for ToX and ToY at all the end points.  Fill in appropriately for ToY and drag it in.

Now save it as a .csv.  this will write the values into the cells and remove the formulas.  Then open it back up in excel and delete all the rows with no values in the ToX and ToY

Bring the spreadsheet into ArcGIS and use the XY to Line tool and it will build your polylines in correct sorted order and you can attribute them as you wish.

This does work.  I  had to create 65000 some spans between all of our transmission structures in our system in sequential order from Structure 1 to whatever on each different line.
New Contributor
I like the idea of the spatial join, and it seems like it should work really easily. But, for some reason, it isn't. I followed your directions, but the results either came out as null or there were 0s for everything.
Thanks

Spatial Join the points to the lines with the lines as your primary target.  Use the One to One option and get the average of the point IDs (modify the field list summary options for the point number field) assigned to the lines and then sort the lines according to the original line ID and the averaged Point IDs.  Truncate the fractional portion if you wanted the numbers to match the point at the beginning of the line (assuming you have a point at the beginning).  This assumes no points exist at the intersection of two or more lines.  If that was possible I would apply the process iteratively for one line and matching point set at a time or use my second option.

I would alternatively use linear referencing for this.  The Create Route tool can assign measures along the line in a way that matched the arrangement of your points.  You would need points at each line end for this to work.  Then I would use the Located Features Along Route tool to match up the points to the line in an event table.  Then I would copy the event table, subtract 1 from each point number and merge the two tables.  Then I would get the Summary Statistics with the unique case being for each Route ID and Point Number and get the Min and Max of the measures of the points.  This creates a line table that can be Sorted by Point ID or Min or Max measure to sequence the way you want.  Export the line events to actual lines if you need to.
MVP Honored Contributor
I like the idea of the spatial join, and it seems like it should work really easily. But, for some reason, it isn't. I followed your directions, but the results either came out as null or there were 0s for everything.
Thanks

Without a picture of your original lines and points its hard to say what is occurring.  Spatial Join is a pretty reliable tool with a long usage history, so it is not likely due to a bug and more likely due to the way you applied the tool.  Did you use an appropriate spatial tolerance for the points?  If you select any line features you also have to select the points you want the tool to process for the tool to work correctly.  Otherwise both lines and points have to be totally unselected to process everything.  Did you right click the field with the Point Numbers and change its summary type from Sum to Avg?  You have to do that.  Are the PointIDs actual numbers and not text?  Anyway, screen shot your line and points and your configuration of the Spatial Join tool please.