Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Cut first 10km of Polyline

grossal
15 - Aurora
15 - Aurora

Hello everyone,

 

I have a dataset with (10k+) Polylines to track objects. We always need to cut the first 10 Kilometers of every Polyline to remove starting noise. I have a general idea about how I can solve the problem, but I wonder if any of the Spatial-Experts here have an easier way to achieve it.

 

If the line was straight, I would have used a Trade Area and subtract the area from my Polyline to get to the wanted result, but sadly the lines do not follow a straight path and I need to cut it at the 10 Kilometer checkmark - no matter if this might be just hundreds of meters away from the starting point.

 

I thought about splitting the data into Points using the Poly-Split Tool and than building an iterative Macro that builds the line from the back till it reaches Total-Distance - 10km. As it will unlikely cut exactly at 10km, I would probably try some hackaround to achieve the precision for the last meters.

 

I am not sure if there is already something like a "Generate Points"-Tool that generates linear points with distance x between a starting point and a target, but it should be easy to do if the tool doesn't exist. I'd be fine if I can achieve a precision of 100 meters (1% of 10km) for the checkmark.

 

What are your thoughts? 

 

(I am sorry that I cannot share sample data)

 

 

Thanks in advance

Alex

4 REPLIES 4
AngelosPachis
16 - Nebula

Hi @grossal ,

 

Are those 10k polylines connected? What I would suggest is splitting the polylines into points like you mentioned and then you can use a multi-row formula tool to estimate the distance of the first point to the next one (as the crow flies). That will help you create a running total that at some point will reach (and exceed) the 10km mark.

 

To find the point which is exactly 10 km from the start point, you might want to isolate the points that are before and after the 10k mark (assuming point N is 9.89km from start and point N+1 is 10.03km from the start). If you isolate those two points and draw a line that connect the two, you will then be able to use a trade area tool with an area of 0.11 km from the first point (9.89+0.11=10km) and the intersection of that trade area with the line that connects those two points will be a new point which is 10km away from the start.

 

Hope that makes sense in a way although I've used the word "points" quite a lot.

 

Regards,

Angelos

grossal
15 - Aurora
15 - Aurora

Hi @AngelosPachis,

 

thanks for your answer - I like it. I am actually surprised that my mind somehow suggested to use an iterative macro when the Multi-Row Formula is also possible and easier to perform. I also like the idea with the trade area tool a lot - it's a neat way to create just the missing point. Thank you for your input!

 

Have a great day 🙂

 

Best

Alex

CharlieS
17 - Castor
17 - Castor

Hey @grossal 

 

Check out this Runner's Map I made a while back. It takes a polyline and marks the segments by Km/Mi for runners to pace distance and timing. This one works by breaking down each linear segment into smaller intervals so they can be rolled back up into the intervals you desire (the interval is adjustable for accuracy/processing). There are more accurate ways to do this, but it was meant to be an approachable spatial example.

5_reportmap.png

As far as more accurate methods go, after breaking down the segments, I would use a running total tool to determine which segment you need to split and where along that linear segment you need the point to be. Then use the start point, direction of linear segment and the Haversine formula to compute the end point (which will also be the start point of the next segment). Or of course use the method outlined above to intersect that last segment and a trade area with a radius that is the last part of the total distance you need to travel to obtain that line segment (and then use the start/end points to rebuild the total 10km if necessary)

atcodedog05
22 - Nova
22 - Nova

Wow, this is just amazing @CharlieS 🙂 I knew you would have something amazing for this usecase.

Labels