community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Generate evenly spaced points along spatial line / polyline

Asteroid

I've attached a simple spatial line feature which is about 28km long. How can I easily generate evenly spaced point features along this line? For example, create a point at the start point of the line, and then at each 1km until the end of the feature?

 

I know I can explode a polyline into its point nodes using poly-split, and I suppose I could do some trigonometry to further subdivide these straight line node-to-node edges to position a point exactly 1km apart. However that sounds like a lot of work.

 

Is there an easier way to create points along a line? I think in ArcGIS this is trivial, but I appreciate comparing Alteryx with ArcGIS is like comparing apples and pears. 

 

Thanks!pointsalongline.JPG

Alteryx Certified Partner

@jt_edin 

 

May not be exact, but here's the closest I was able to come... workflow attached.

image.png

Alteryx Partner

Hi @jt_edin this is what I came up with:

OllieClarke_0-1572272600818.pngOutput

 

I had to make an iterative macro, so you might want to edit the settings of it to suit your use case 

OllieClarke_1-1572272664344.pngThe workflow

OllieClarke_2-1572272687527.pngThe macro

 

Hope that helps,

 

Ollie

Asteroid

Thank you to @OllieClarke and @jrgo for your speedy and ingenious solutions. I hate to be ungrateful, but what if my line isn't so simple, see attached? I had considered the buffer / radius approach, but realised it would only work for relatively 'unbendy' lines. What about the example below?

 

Thank you again for your superb contributions.

 

toughline.JPG 

Alteryx Certified Partner

@jt_edin 

 

yeah, that would definitely through a wrench in my solution. May have to go the macro/iterative route as @OllieClarke had done. Not something I can explore at the moment, but I'll try when i have a chance to if no solution has been marked yet.

Alteryx Certified Partner
Alteryx Certified Partner

I generated a lot of points (0.001 Km intervals) along the original polyline line segments. This retained the accuracy of the original polyline points and gave me very granular distances to group into 1 Km sequences. 

 

20191028-1KmLineSegments.png

Alteryx Certified Partner
Alteryx Certified Partner

Just checked my solution on the "toughline" and it works for that too.

 

20191028-toughline.png

 

Alteryx Partner

@CharlieS your solution is brilliant! Could I trouble you to explain your X and Y calculations?

 

edit: nvm I think I worked it out

Alteryx Certified Partner
Alteryx Certified Partner

@OllieClarke wrote:

Could I trouble you to explain your X and Y calculations?


Sure thing.

 

I have the original polyline input into this section as linear line segments and I've already assigned a number of how many segments I want to break it into (based on the accuracy intervals per length of that linear segment).

 

- Spatial Info generates start and end points as SpatialObjs. In hindsight, I could make the workflow a little more efficient by generating the Lat/Lon values of the points since that's what I actually use. 

- Generate Rows creates a record for each of the accuracy intervals.

- While reviewing this, I realized the Tile tool is redundant since I already have RowCount. I removed it and updated the formulas to reflect this. Sorry for this oversight. 

- Now that I know I know the start and end X/Y values and the portion of that distance each accuracy interval needs to travel, I calculate new X and Y values as moving from the start to the end by the X/Y portion that each record represents of that segment. In other words, if I start at 3 and have 4 parts that end at 4, each part is 0.25 closer since everything is linear at this point. 

- These new X/Y values create spatial objects with the Create Points tool. 

- Select removes unnecessary fields. 

 

I made the version 2 attached that simplifies this section in the ways I mention above. 

 

20191028-1KmLineSegments-AddPoints.png

Highlighted
Asteroid

Just to follow up, this is how I used @CharlieS brilliant solution: https://www.youtube.com/watch?v=3Cny9yl-GaQ&feature=youtu.be

 

I downloaded some bike hire data and infilled probable routes between the origin and destination points. I then used the ride duration to subdivide the route into chunks where each output frame = 1 minute of time. I adapted @CharlieS code and changed an integer to a double to split each line differently depending on the ride duration.

 

Thanks again for your help, I will be presenting on this tomorrow and will flag up how amazing this community is!

 

https://www.eventbrite.com/e/edinburgh-alteryx-user-group-mtg-inaugural-registration-73880824535

This animation was created to publicise the inaugural Edinburgh Alteryx User Group meetup on Wed 30th Oct 2019 - https://www.eventbrite.com/e/edinburgh-alteryx-user-group-mtg-inaugural-registration-73880824535
Labels