ArcPy SegmentAlongLine - Full Syntax

03-19-2019 02:50 PM
Regular Contributor

I have what I hope is a very basic question which someone can easily answer. In ArcMap, ArcGIS Pro, or even IDLE I would like to utilize the ArcPy Class - Geometry - Polyline method to segment a line based on a percentage of the overall line length. If possible I would like to trim a line by 15% of it's total length from the start and end point. In the end it's one line that is 30% shorter than the original line and the remainder is the 'middle' 70%. How do you write this in the Python window such that it is formatted correctly? I am not a developer so I really need the simplest explanation. To no avail I've been trying to locate an existing tool or model that achieves this specific task. Any help is appreciated. My workspace looks like this


Projection: NAD_1983_Contiguous_USA_Albers WKID: 5070

Units: Meters

  • Documentation indicates the Polyline Syntax as:
    • Polyline (inputs, {spatial_reference}, {has_z}, {has_m})
  • And the SegmentAlongLine method as:
    • segmentAlongLine (start_measure, end_measure, {use_percentage})
  • How do you string these together correctly?
0 Kudos
2 Replies
MVP Esteemed Contributor
Regular Contributor

Thank you Dan, I originally started with the editor toolbar in ArcMap and Pro which both have the functionality I need but I have around 250,000 lines so I need some form of model or code which iterates through each line or row. I could do it in model builder if that darn method (segmentAlongLine) was exposed as a tool but sadly it is not. I’ll take a look at your links and keep working towards a solution. Thanks again for your help.

0 Kudos