It would be helpful if there were an OOTB geoprocessing tool for shrinking lines at each end. By a measure or a percentage.
It would also be good if the tool could stretch out lines too -- using the angle of the last segment at each end. Or make that separate GP tool.
Thanks.
Related: Batch shrink lines at each end
Just want to make sure you are aware of Trim Line and Extend Line tools:
https://pro.arcgis.com/en/pro-app/latest/tool-reference/editing/trim-line.htm
https://pro.arcgis.com/en/pro-app/latest/tool-reference/editing/extend-line.htm
@DanLee Thanks.
As far as I can tell, the Trim Line tool can't be used to shrink lines -- when dangles aren't involved.
Not directly, you are right. You might have to find a way to generate a crossing line at where you need to trim to. Then select both the line you need to trim and the crossing line to use Trim Line tool.
I am a bit curious about why you need to shorten the line in both ends. Do you mind describing what you need to do?
Just a thought for a potential workflow: if you have the line(s) selected, you can do the following:
- Use Feature Vertices To Points tool with Both_ends option to obtain the endpoints of the line(s).
- Use Butter tool to buffer the points with the distance that you want to shorten the line at both ends.
- Use Erase tool to erase the lines by the buffer polygons; your lines are shortened.
Would that work? 🙂
Here's my current use case, although there are others:
For each road line, I want to count the number of right-of-way polygons that the line intersects (using the Spatial Join geoprocessing tool). The relationship should always be 1 line to 1 polygon. So if the spatial join count isn't 1, then that area needs to be investigated.
The problem is, the roads often slightly overlap other polygons at road intersections, since the polygons aren't snapped to the road endpoints. And automatic snapping isn't an option in scenarios like these: screenshot. So the spatial join will count polygons that I don't care about.
So I figure, if I shorten the lines at each end in a copy FC, either by a measure or by a percentage, then that will avoid counting polygons that just barely overlap the roads.
What do you think?
For my notes, in general, I can think of a few scenarios I need to check for:
Regarding the potential workflow you provided. I will check it out. Thanks!
Note: this comment has been edited to clarify some details and to switch red box #1 and #2 to match Bud's notation change. - Dan
Perhaps you can use Feature Vertices To Points with Midpoint option to obtain midpoint of each line. Then use Spatial Join to join polygons with the midpoints using "Contains" option. For your scenarios:
With these processes, you may not need to shorten your lines?
No problem. See my "Note" at top of my comment above.
Hi @Bud,
I've created a script tool for you that shrinks lines at both ends by a percentage or length.
You can add it to your project from Pro by navigating to the ArcGIS Online tab under Catalog > Portal and searching for "Shrink Line". Note that you have to be logged into ArcGIS Online for this.
Alternatively, you can access it here: https://arcg.is/9H8S8
Please let me know if you have any questions or feedback. Thanks!
Hey @Bud,
Sean Lim who posted the script tool, Shrink Line, above is my teammate. He had some account conflict issue to resolve; that's why there is no Esri badge next to his name. If you are still interested in this tool, please give it a try and let Sean know if it is helpful to solving your problem. Thanks. - Dan
Thanks @SeanLim!
Just a heads up:
I had a rare case where one of the features in my FC had a null geometry. And that caused an error in the tool.
(mobile GDB; ArcGIS Pro 3.1)
But that's an uncommon scenario. It might not be worth worrying about.
Still testing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.