Select to view content in your preferred language

How can I average multiple polylines?

7479
5
10-13-2015 08:25 PM
Labels (3)
JohnLongsworth
Deactivated User

Hi there, I'm a fairly new user here from the horticultural field. I'm (attempting to) mapping a small trail system in a wooded park using ArcGIS Pro. Via the desktop application I created a dataset with a Polyline and using the Collector app I streamed and saved four lines of the same trail. The Polyines are all within a few meters of each other but I'd like to create a new Polyline as a mean of the originals. As I mentioned I'm a beginning user. How can I complete this?

Thanks for any direction!

-John

0 Kudos
5 Replies
NeilAyres
MVP Alum

Actually, that's not a simple problem. See attached pdf for one example.

If its just a once off, hand digitizing through the "middle" of your existing data might be the way to go.

0 Kudos
ChrisSmith7
Honored Contributor

John,

There was another discussion about this a few years back that has some good info, including a recipe that worked for one user (although no code was given):

"Averaging" lines?

0 Kudos
SimonGIS
Regular Contributor

Anyone seen a recent approach to doing this in batch?

0 Kudos
CarlBeyerhelm
Frequent Contributor

Here is code that constructs a line that is the “mean”, or “average”, of two similar lines.  A typical use case is creating an average trail alignment from two GPS tracks of the same trail.

Tool inputs are two feature classes that each contain a single polyline that is similar to the polyline in the companion feature class.  For example, one feature class might contain the north-bound GPS track of a trail, while the second feature class contains the south-bound GPS track of the same trail.

The feature classes can be of either .SHP or .GDB format, braided or unbraided, and with either a projected or GCS spatial reference.  The finished mean line will be written into the first input’s workspace, and will have the first input’s spatial reference.

See the illustrations below for examples of the result.  The code (as a txt file) is also attached, and could be adapted to batch processing.

0 Kudos
DrewFlater
Esri Regular Contributor

I have published a new Geoprocessing Sample tool for averaging lines. You can download it and see if it works for your use case.

https://www.arcgis.com/home/item.html?id=e47c400683ad443781660cef529a7637

0 Kudos