Help iterating over a table to create chainages using Python in Model Builder

by stanleykubrick   Last Updated October 09, 2019 19:22 PM - source

I routinely have to do the following workflow:

  • Map GPS points;-

  • Create lines based on those GPS points;

  • Split the lines at a set interval distance (every 50m, every 100m etc.)

  • Add from / to fields for chainages along the line.

I use Model Builder to automate this process as much as possible, but to generate the chainages, I need to use Excel because I have very limited experience with Python. So I generate the chainage values in Excel, then in the editor context in ArcGIS copy those values from Excel into the attribute table of my polyline features. I'm wondering if you folks could help my transfer the logic I have in my Excel sheet over to Python to use in the Calculate Field tool within Model Builder?

The format of the from / to fields ends up being "K+MMM" where the K is the kilometer and the M's represent meters. So if I've got a starting point of 0km and 0m and an interval of 100m, the first chainage would read "0+000", followed by "0+100", "0+200".

Here are some screenshots of the logic in the Excel file: https://imgur.com/a/LHYyi0u



Related Questions



Python Group by attribute range

Updated October 16, 2018 19:22 PM


Using a Python Script Input parameter as an output

Updated March 09, 2018 15:22 PM