Updated – 4/10/2015
Can now shorten the polylines from both sides, this keeps the middle part of the polyline
Previous Updates
Fixed compatibility with Python 3 for ArcGIS Pro
Output polylines now retain original vertices, whereas before the features were simplified into straight lines
(If you’re using Firefox, then right click and Save Link As)
Download the Shorten Polylines Toolbox – works with ArcGIS 10.2+
View the Source Code
(any donations go towards hosting costs)
Only use the following download if you have ArcGIS 10.1 or earlier. This version will not retain the original line shape.
Download the Shorten Polylines Toolbox
View the Source Code
The Shorten Polylines tool takes an input Polyline feature class and shortens each polyline feature based on a specified distance or percentage value. The value can either be fixed or field based.
You can now shorten the lines based on either the beginning, end, or both sides as shown in the screenshot below. If BOTH is chosen, then the middle portion of the polyline is kept. Also, if BOTH is chosen the distance or percentage value is divided by two.
The output Polyline feature class containing the shortened polylines will have a field called LineOID which states the OID of the original polyline it was created from. This allows any attribute information to be joined back to the new polylines. It will also contain a field called Value, which states the value that was used to create the line.
If a field is being used to assign the value, any features with null values will be skipped. If the polylines are being shortened using a PERCENTAGE, the value must be in decimal format and between 0 and 1.0. All features with values outside this range will be skipped. If the polylines are being shortened using a DISTANCE, the value must be positive. All features with negative numbers will be skipped.
Be sure to view the Tool Help within the tool dialog box for detailed instructions. Also, check the Geoprocessing Results for any error messages.
Here’s a screenshot of the parameters:
I hope someone finds this tool useful. Please leave a comment if you have any questions or problems, and be sure to check out the other tools I’ve created!
11 thoughts on “ArcGIS Toolbox – Shorten Polylines by Percentage or Distance with ArcPy”