Best way to merge many lines into one calculated line using ArcPy?

07-24-2019 03:22 PM
New Contributor

I'm working on an ETL process to pull data from one data source (a web API, provided by a generic data service) and entering it into a SQL Server database used by a client with ArcMap. I'm also semi-new to ArcGIS, so some of this is over my head.

The features I'm importing are all user-collected, and are usually collected by multiple people at multiple different times, which leads to a lack of uniformity in the geospatial information.

So far everything is great, but here's where I start getting lost. Some feature layers contain lines that are composites of the lines in another feature layer. People collect coordinates as they hike part of a route, and upload their hike and which route they were hiking. I have a feature layer  called SubRoute, who's features represent each hiking path, and a feature layer called Route that will contain features representing the path of an entire hiking route. I want to use SubRoutes to calculate the entire Route path by combining everyone's individual hike.

During development, I was provided with test data which was all nearly ideal (and ordered). No two SubRoutes overlapped, and each began near where the last one ended. I was able to simply append each line together to get one perfect line.  The test data looked similar to Graph A in the attached image.

Now, Im looking at the real-world data and it looks more like Graph B, with the potential to look like Graph C or worse. Obviously, my previous approach won't work at all. Now I'm kind of stuck.

How would I take a group of lines, and create one composite line to represent the "average" (for lack of better words) of all of the lines? The blue line in Graphs A and B is what I am looking for.

Do you guys have any suggestions?

Examples A, B, and C

Bonus problem: After I find the composite line, I would like the take all the individual lines and change them to overlay the new composite line. I'm assuming the Snap tool is best for this?

Thanks for your time, I really appreciate any advice or suggestions!


0 Kudos
1 Reply
MVP Legendary Contributor

buffer your polylines by a finite amount to collapse the inter-line space

convert the buffer to a centerline

Polygon To Centerline—Topographic Production toolbox | ArcGIS Desktop 

good first start

0 Kudos